rregressionlinear-regressionplm

Adding robust standard errors to original panel model in R


I use a within plm model:

model <- plm(Y ~ x1 + x2 + x3, data=dataset, model="within", effect="twoways")

I detected heteroskedasticity and calculated robust standard errors with the vcovHC function from the plm package:

coeftest(model, vcov = vcovHC(model, method = "arellano"))

But unfortunately, I don't know how to "add" these robust standard errors to my original model. I do get the results with the vcovHC function:

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

But it does not print the usual regression statistic like when I would run summary(model):

Total Sum of Squares:    
Residual Sum of Squares: 
R-Squared:      
Adj. R-Squared: 
F-statistic:  , p-value:

So, I would like to find a way to merge the robust standard errors of the vcovHC function with my plm model.


Solution

  • May I suggest to have a look at the documentation: ?summary.plm. You will find explanation as well as an example that is easy to transfer to your requirement:

    summary(model, vcov = function(x) vcovHC(x, method = "arellano"))