1
$\begingroup$

I am looking for a way to implement (country) clustered standard errors on a panel regression with individual fixed effects. That is, in plm() I want to define some individual_id variable as index, but I want another variable called country to be the clusters for my cluster robust standard errors. All while working whith multiple imputations.

I have found a package named bucky with the function mi.eval() which looks promising. It wraps around another R function and implements it for multiple imputations. It even comes with its own cluster option, but for me, it does not work somehow.

#first split data set by implicate_number
data.list <- split(as.data.frame(data), factor(data$implicate_number))

#define model
m1 <- y ~ country + time + country*time

#estimate
result <- mi.eval(plm(m1, data = imputationList(data.list), 
                     index = "individual_ID", 
                     model = "within"),
                 robust = TRUE,
                 cluster = country
)
Error in UseMethod("estfun") : 
   no applicable method for 'estfun' applied to an object of class "c('plm', 'panelmodel')"

However, it works when I leave the cluster argument complete out. The error message must therefore have something to do with the cluster argument.

I thought of trying to wrap the mi.eval() around some function like coeftest(plm(...), vcov=vcovHC(plm(...), cluster="group")) but I see here two problems:

  • As vcovHC() allows only for "group" or "time" as options for the cluster argument, I would need to include country as index in plm(), as stated in the answer to this question, which I don't want: I want countries to be explicit parts of the model in order to interact them with time. (The whole thing is a diff-in-diff setting.)

  • It doesn't work anyway:

mi.eval(coeftest(plm(m1, data = imputationList(data.list), 
             index = "individual_ID", 
             model = "within"), 
         vcov=vcovHC(plm(m1, data = imputationList(data.list), 
                         index = "individual_ID", 
                         model = "within"),
                     cluster = "group")))

Error in mi.eval(coeftest(plm(m1, data = imputationList(data.list), index = "individual_ID",  : 
  Must use "data" option for multiple imputation.

So, my question is: Where is my mistake? Do you know another way to pair a panel regression with individual fixed effects, clustered standard errors and multiple imputations in R?

I am thankful for any hint that could help me here :-)

PS: I found it very strange vcovHC() is not flexible to use a different variable for cluster robust SE than those used in plm() as index. Is my idea of doing diff-in-diff with country and time while employing plm() only to absorb individual fixed effects so far off?

Cheers!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.