1
votes

I am using the plm function (from package plm) using fixed effects.

I need to guarantee that I am using heteroscedasticity-robust standard errors while using the function plm.

lag1.1 <- plm(E.primary ~ lv18_bank_c + Expense + lag(Expense, 1), data=panel_exog1, index=c("Country", "Year"), model="within")

How do I get heteroscedasticity-robust standard errors for that model?

1

1 Answers

1
votes

You may use plm::vcovHC.plm which is implemented in the plm:::summary.plm() method. Use specific options method= and type=. Example:

library(plm)
data("Produc", package="plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
          data=Produc, index=c("state", "year"), method="within", effect="twoways")

## normal SE
summary(zz)$coe
#               Estimate  Std. Error   t-value      Pr(>|t|)
# log(pcap) -0.030176057 0.026936544 -1.120265  2.629606e-01
# log(pc)    0.168828035 0.027656339  6.104497  1.655450e-09
# log(emp)   0.769306196 0.028141794 27.336786 1.275556e-114
# unemp     -0.004221093 0.001138837 -3.706493  2.256597e-04

## heteroscedasticity-robust SE
summary(zz, vcov=vcovHC(zz, method="white1", type="HC1"))$coe
#               Estimate  Std. Error   t-value     Pr(>|t|)
# log(pcap) -0.030176057 0.029880301 -1.009898 3.128707e-01
# log(pc)    0.168828035 0.038079746  4.433539 1.065916e-05
# log(emp)   0.769306196 0.038808010 19.823387 1.301129e-70
# unemp     -0.004221093 0.001357489 -3.109486 1.945209e-03

Read ?vcovHC.plm for further information on method= and type=.