0
votes

I have run a regression for my time-series cross-sectional data. Now, I would like to include panel-corrected standard errors. The plm regression works without any problems. Unfortunately, I am not sure how to do this as the pcse function does not work.

library(plm)
reg1 <- plm(Var2 ~ Var1 + Var3 + Var4, data=testdf, index=c("country", "year"), model="random")
library(pcse)
pcse(reg1, country, year, pairwise=FALSE)

Is pcse the wrong function, and is there a possibility to include the calculation of panel-corrected standard errors in the plm regression already?

1

1 Answers

1
votes

The pcse package requires a object of class lm. Since you estimated the model with plm, pcse gives an error. However, plm has a native function to estimate panel-corrected standard errors, vcovBK():

library(plm)
library(lmtest)

data("Grunfeld", package = "plm")
plm_fit <- plm(inv ~ value + capital, data = Grunfeld, model = "random", index = c("firm", "year"))
coeftest(plm_fit, vcov=vcovBK(plm_fit, cluster = "time"))
#> 
#> t test of coefficients:
#> 
#>               Estimate Std. Error t value  Pr(>|t|)    
#> (Intercept) -57.834415  30.396538 -1.9027   0.05854 .  
#> value         0.109781   0.016230  6.7643 1.491e-10 ***
#> capital       0.308113   0.024574 12.5380 < 2.2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Created on 2020-04-16 by the reprex package (v0.3.0)