I'm currently working on some data from an experiment. Thus, I have data about some individuals who are randomly assigned to 2 different treatments. For each treatment, we ran three sessions. In each session, participants were asked to make a sequence of decisions.
What I would like to do is to: (1) estimate the effect of the treatment with a model that includes random effects on individuals and afterwards, (2) clustering the standard errors by session.
In R, I can easily estimate the random effect model with the plm package:
model.plm<-plm(formula=DependentVar~TreatmentVar+SomeIndependentVars,data=data,
model="random",effect="individual")
My problem is that I'm not able to cluster the standard errors by the variable session, i.e. the session the individuals participated in. Indeed the Robust Covariance Matrix Estimators of the plm package let me choose between 2 types of clusters: "groups" and "time". So, if I choose the option "group" I get standard errors clustered at the individual level:
vcovHC(model.plm,type="HC0",cluster="group")
Is there a way to choose a different clustering variable ?
I will very much appreciate your help.
You may be interested in this: https://stats.stackexchange.com/questions/85909/why-does-a-fixed-effect-ols-need-unique-time-elements
Here's my solution for "within" models:
I suspect you actually need the variables, so instead of generating a fake time generate a "fake" group--just make up a new group identifier right after you grab each bootstrap sample.