R Sandwich包是否没有生成预期的聚类稳健标准误差?

问题描述 投票:0回答:1

加载数据

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+yearcluster=~cluster_var 是等价的吗?

另外,我找不到一个地方(如Github)来报告R sandwich包的问题,我找到了这个,但只是一个只读的镜像。https:/github.comcransandwich。

先谢谢你了。

r package cluster-computing linear-regression robust
1个回答
0
投票

cluster=~company+year 确实是不同的东西:"多向聚类"。我在这里找到了解释。

http:/fmwww.bc.edurepecbost10BOS10.baum.pdf

https:/francish.netlify.apppostnote-robust-standard-errors。

© www.soinside.com 2019 - 2024. All rights reserved.