你好,Stata命令应该是这样的:
xtreg Y X1 X2 X3,fe
estimates store fe
hausman fe
你可以在Stata中使用 help hausman: (以下为节选内容)
hausman name-consistent [name-efficient] [, options]
where name-consistent and name-efficient are names under which estimation results were saved via estimates store.
用聚类稳健标准差得来的是无法用豪斯曼检验的,但是传统的回归又会使得豪斯曼检验无效!建议:
quietly xtreg y x1 x2 x3 x4,re
scalar theta=e(theta)
global yandxforhausman y x1 x2 x3 x4
sort state
foreach x of varlist $yandxforhausman {
by state:egen mean`x'=mean(`x')
gen md`x'=`x'-mean`x'
gen red`x'=`x'-theta*mean`x'
}
quietly xtreg redy redx1 redx2 redx3 redx4 mdx1 mdx2 mdx3 mdx4,vce(cluster state)
test mdx1 mdx2 mdx3 mdx4