向 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"))
我在 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"))