我正在使用 stargazer() 显示 OLS 的结果,包括两个模型 m3adj 和 m4adj 的稳健标准误差。 这是我的代码:
model.lst <- list(m3adj, m4adj)
stargazer(model.lst,
title = "Initial Results",
type = "html",
align = TRUE,
no.space=TRUE,
column.labels = c("Model 1 (Main effect)", "Model 2 (Main effect of sub dimensions)"),
omit.stat=c("LL","ser", "f"),
ord.intercepts = TRUE,
notes.append=TRUE,
se = c(list(NULL,robust_se3, NULL, robust_se4)), #include robust standard errors
single.row = TRUE,
report = "vcs*",
notes="Heteroscedasticity-robust standard errors in parantheses.",
add.lines=list(c('Year-quarter fixed effects', 'Yes','Yes')),
star.cutoffs = c(0.05, 0.01, 0.001)
)
但是,我在
robust_se3
和 robust_se4
中计算的稳健标准误差仅部分显示。我只在模型 1 的括号中得到 SE,但对于模型 2,我在括号中得到随机数,并且仅得到几个变量的随机数。有什么想法可以修复我的代码,以便我可以为这两个模型包含强大的 SE?
我自己找到了答案: 首先使用代码计算每个模型m3和m4的稳健标准误差
robust_se2 <- sqrt(diag(vcovHC(m2, type = "HC0")))
然后按如下方式调整stargazer:
model.lst <- list(m3, m4)
stargazer(model.lst,
title = "Initial Results",
type = "html",
align = TRUE,
no.space=TRUE,
column.labels = c("Model 1 (Main effect)", "Model 2 (Main effect of sub dimensions)"),
omit.stat=c("LL","ser", "f"),
ord.intercepts = TRUE,
notes.append=TRUE,
se = list(robust_se3, NULL, robust_se4), #include robust standard errors
single.row = TRUE,
report = "vcs*",
notes="Heteroscedasticity-robust standard errors in parantheses.",
add.lines=list(c('Year-quarter fixed effects', 'Yes','Yes')),
star.cutoffs = c(0.05, 0.01, 0.001)
)