Panel 데이터에 대한 회귀분석을 포스팅 주제로 한 번 다루고 싶은데 너무 많아서 못하겠고, 일단 Panel data 설명 잘 된 자료들 링크를 걸어둔다.
http://www.longitudinal.stir.ac.uk/talks/db_panelmodels.ppt
http://www.indiana.edu/~statmath/stat/all/panel/
http://dss.princeton.edu/online_help/analysis/panel.htm
보면 panel 데이터를 다룰 때는 개인별 특성이 종속변수에 미치는 영향이 서로 다르다고 가정하는 fixed effect(=stata에서 within effect) 와 시간에 대해서는 변하지만, 케이스사이에서는 일정한 누락변수를 컨트롤 하기 위해 사용하는 between effect model 이 있다. 이 둘을 가중평균한게 random effect model이다. 더 직관적인 설명은 다음 포스팅에서 다룰 예정이다. 오늘 포스팅 주제는....
STATA에서 Hausman test 방법
1. compute the always-consistent estimator
2. estimates store name-consistent
3. compute the estimator that is efficient undef H0
4. hausman name-consistent
(이탤릭체는 사용자가 지정한 estimation 의 이름)
혹은
1. compute the estimator that is efficient under H0
2. estimates store name-efficient
3. (fit the less-efficient model)
4. compute the always-consistent estimator
5. hausman . name-efficient
출처: Stata Manual, [R] 중 hausman 부분
위와 아래의 차이점은 어떤 test를 먼저 실시하냐는 것이다. 먼저 실시하는 regression이 consistent 일 경우와 efficient 일 경우에 hausman 뒤에 점을 찍는지 안찍는지도 다르고, 이 때 테스팅 결과가 바뀌게 된다. 인터넷에서 찾았던 모 레퍼런스에는 먼저 실시하는 regression이 true라는 귀무가설이 자동적으로 성립된다고 하는데, 그건 아닌 것 같다. 흑 역시 인터넷보다는 책이다.
자 이제 실제 예를 들어보자(헷갈리지 않게, 일반적인 방법인 위의 방법을 따라.).
1) fixed effect model (consistent) 에 대한 추정을 한다.
2) 추정식을 저장한다.
3) random effect model (more efficient)에 대한 추정을 한다.
4) 추정식을 저장한다. (생략 가능)
5) 하우스만 테스트를 한다. 첫번째 저장한 식을 먼저 쓴다.
6) p-value가 유의하다면 귀무가설(random effect 모델이 더 낫다)을 기각하고, 대립가설(fixed effect model을 사용한다)을 채택한다.
여기서 순서가 무지 중요하다는 거 잊지 말자. fixed effect와 random effect를 비교할 때, fixed effect estimates는 robust estimates (consistent) 로 간주되고, random effect 모델은 efficient estimates로 간주된다. (why?)
순서를 바꿔서 실습해보면 통계량의 부호가 바뀌게 된다. hausman test의 경우 카이제곱 분포를 따르기 때문에 부호가 바뀌는게 매우 중요하다(부호가 바뀌면 테스트를 수행할 수 없다). 사실 이 포스팅을 하는 이유가 순서가 바뀌는 것에 따라 hausman test의 결과가 바뀐다는 말을 어디서 보고는 stata에서 설정하고 있는 귀무가설이 뭔지 몰라서 찾아서 정리해본 것이다.
자. 다음은 실습예제. 다음 코드 그대로 스타타에 쳐보면 알게 될 것임.
use http://www.stata-press.com/data/r9/nlswork4
describe
xtreg ln_wage age msp ttl_exp, fe
estimates store fixed
xtreg ln_wage age msp ttl_exp, re
hausman fixed
위와 같이 치면, 결과가 prob=0.0000 이 나온다. 따라서 귀무가설을 기각하고 대립가설을 채택해서, fixed effect model을 사용한다. 아 깔끔해. ㅋ
'hausman'에 해당되는 글 1건
- 2009/07/17 Choosing between Fixed and Random Effects (2)
Comment 2


