作为一名非统计学家,我在这里达到了我的极限:
我尝试为面板数据拟合泊松模型(使用pglm
),并且我想计算稳健的标准误差(使用lmtest
)。
我的代码目前如下所示:
#poisson model (panel with year fixed effects):
poisson_model <- pglm(y ~ a + b + c + factor(year), data = regression_data,
model = "pooling", family = poisson, index = c("ID", "year"))
#robust standard errors:
robust_SE_model <- coeftest(poisson_model, vcov. = vcovHC(poisson_model, type = "HC1"))
当我使用 拟合常规面板模型时,此代码适用于我的其他模型规范之一plm
,但是当我尝试使用泊松模型时,pglm
我收到以下错误消息:
Error in terms.default(object) : no terms component nor attribute
这是由于lmtest
包装的限制还是我在这里犯了错误?我真的希望我可以使用包(不一定pglm
和lmtest
)来解决问题,并且不必深入手动计算稳健错误。
非常感谢任何帮助!