utils::data("InstInnovation", package = "sandwich")
df <- InstInnovation
df[['cluster_var']] <- factor(paste0(df$company,"-",df$year))
model <- lm(sales ~ competition + log(capital/employment) + year, data = df)
lmtest::coeftest(model, vcov = vcovCL(model, type="HC3", cluster=~company+year))
lmtest::coeftest(model, vcov = vcovCL(model, type="HC3", cluster=~cluster_var))
Shouldn't cluster=~company+year
and cluster=~cluster_var
be equivalent?
In addition, I cannot find a place (e.g. Github) to report issues on R sandwich package, I found this but is just a read-only mirror: https://github.com/cran/sandwich
Thank you very much in advance.
cluster=~company+year
is indeed something different: 'multiway clustering'. I found the explanation here:
http://fmwww.bc.edu/repec/bost10/BOS10.baum.pdf
https://francish.netlify.app/post/note-on-robust-standard-errors/