![](/img/trans.png)
[英]R's sandwich package producing strange results for robust standard errors in linear model
[英]Is R Sandwich package not generating the expected clustered robust standard errors?
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))
cluster=~company+year
和cluster=~cluster_var
不应该是等价的吗?
此外,我找不到一个地方(例如 Github)来报告关于 R 三明治 package 的问题,我找到了这个但只是一个只读镜像: Z5E056C500A1C4B6A7110B50/cran/sandwich.com
非常感谢您提前。
cluster=~company+year
确实有所不同:“多路聚类”。 我在这里找到了解释:
http://fmwww.bc.edu/repec/bost10/BOS10.baum.pdf
https://francish.netlify.app/post/note-on-robust-standard-errors/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.