python - 解释 Hausman 测试结果 Python(线性模型)
问题描述
这是我的代码:
ivmod = IV2SLS(y, None, df['VariableOne'], df['RandomVariable'])
res_2sls = ivmod.fit()
res_2sls.wu_hausman()
这是测试结果:
Wu-Hausman test of exogeneity
H0: All endogenous variables are exogenous
Statistic: 6.7774
P-value: 0.0096
Distributed: F(1,398)
WaldTestStatistic, id: 0x7fe9ff715d50
我这样做对吗?我对结果有何看法?
解决方案
当您使用 Hausmann 检验拒绝时,您实际上是将 VariableOne 上参数的 OLS 估计值与相同的 2SLS 估计值进行比较。如果这两个估计值不同,那么您应该相信该变量是内生的。如果它们相同(在统计意义上),那么您通常应该使用 OLS。请注意,豪斯曼检验不是弱工具鲁棒性,因此如果您使用随机数据作为工具,则您的测试无效。