0

I am a beginner in R. I am using the plm package and I want to know the easiest way to get cluster robust standard errors for the fixed effects estimator. My data (called Mydata) is on poverty, GDP, investment, and education in 130 countries over 33 years, and my index in plm is country and time. My model is something like this:

Fixedeffect<-plm(Y~ X_(i,t) + W_(i,t) + Z_(i,t) , data=Mydata, model= "within")

Where Y, X, W, and Z are all panel data variables.

I read this post: Standard error clustering in R (either manually or in plm) , but it didn't help.

Someone there suggested to use this:

coeftest(model.plm,vcov=vcovHC(model.plm,type="HC0",cluster="group"))

but it didn't work for me. I got the following error:

could not find function "coeftest"

Can anyone help, Please?

  • 1
    You should explain in what way the linked post wasn't helpful. The likely reason that coeftest wasn't found would be that you didn't load the package that has that function in it. I presume that's the coeftest function in lmtest – Glen_b Jun 29 '14 at 20:28
  • Thanks. The post wan unhelpful because it is way advanced for my level of understanding of R. But the coeftest worked just fine once I loaded the lmtest package. Thanks again @Glen_b – user49017 Jun 29 '14 at 21:57
  • No. That was a mistake. – user49017 Jun 30 '14 at 04:50

0 Answers0