I'm running a regression in R's plm
package similar to this post Clustered standard errors in R using plm (with fixed effects). I.e. panel data with fixed effects and the within-model from plm
.
My Question is the following: I'm trying to figure out how to cluster my standard errors according to a different variable than the variable called state from the dataset Cigar
, which is seemingly automatically used by the cluster = 'group'
option in vcovHC
. Specifically, if I e.g. have a variable called id
, how can I tell vcovHC
to use it as my cluster?
A very related question is the process of how vcocHC
is selecting the variable for clustering, is it always just the first column in the dataset?
clustering
tag. Please be attentive selecting tags. $\endgroup$