![](/img/trans.png)
[英]Error computing Robust Standard errors in Panel regression model (plm,R)
[英]Adding robust standard errors to original panel model in R
我使用内部plm
模型:
model <- plm(Y ~ x1 + x2 + x3, data=dataset, model="within", effect="twoways")
我使用plm
包中的vcovHC
函数检测了异方差并计算了稳健的标准误差:
coeftest(model, vcov = vcovHC(model, method = "arellano"))
但不幸的是,我不知道如何将这些强大的标准错误“添加”到我的原始模型中。 我确实使用vcovHC
函数得到了结果:
t test of coefficients:
Estimate Std. Error t value Pr(>|t|)
x1 0.04589038 0.02465875 1.8610 0.06317 **
x2 -0.00065238 0.00027054 1.4114 0.01615 *
x3 -0.00087420 0.00043580 1.0059 0.04525 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
但它不会像我运行summary(model)
时那样打印通常的回归统计信息:
Total Sum of Squares:
Residual Sum of Squares:
R-Squared:
Adj. R-Squared:
F-statistic: , p-value:
因此,我想找到一种方法将vcovHC
函数的稳健标准误差与我的plm
模型合并。
我可以建议看看文档: ?summary.plm
。 您将找到解释以及易于转移到您的要求的示例:
summary(model, vcov = function(x) vcovHC(x, method = "arellano"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.