对于我的stargazer
表,我想包括弱仪器的诊断和 Wu Hausman 测试。我阅读了以下答案:R: Robust SE's and model diagnostics in stargazer table。
虽然,我真的不明白这一点。如何将其应用于具有 9 或 10 列的更大模型?如何插入您在编码时获得的诊断信息summary(ivreg1, diagnostics=TRUE)
?我对观星者表有以下代码:
ivreg1 <- ivreg(budget ~ policyfactor1 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg2 <- ivreg(budget ~ policyfactor2 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg3 <- ivreg(budget ~ policyfactor3 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg4 <- ivreg(budget ~ policyfactor4 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg5 <- ivreg(budget ~ policyfactor5 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg6 <- ivreg(budget ~ policyfactor6 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg7 <- ivreg(budget ~ policyfactor7 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg8 <- ivreg(budget ~ policyfactor8 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
ivreg9 <- ivreg(budget ~ policyfactor9 + control1 + control2 + control3 | iv + control1 + control2 + control3, data=df)
stargazer(ivreg1, ivreg2, ivreg3, ivreg4, ivreg5, ivreg6, ivreg7, ivreg8, ivreg9, title="Regression results", align=TRUE, column.sep.width = "-15pt", font.size = "small", type="latex")
我有以下数据框示例:
data.frame(
budget = c(10, 8, -7, 8, 3, 2, 0.5, 1.5, -2, -15, 30, -0.5, 12, 18),
policyfactor1 = c(1L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 1L),
policyfactor2 = c(0L, 1L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L),
policyfactor3 = c(0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 0L, 0L),
policyfactor4 = c(1L, 0L, 1L, 0L, 0L, 1L, NA, NA, 1L, 1L, 0L, 1L, 1L, 0L),
policyfactor5 = c(1L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L),
policyfactor6 = c(0L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, NA, 0L),
policyfactor7 = c(0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L),
policyfactor8 = c(1L, 0L, 1L, 1L, NA, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 0L),
policyfactor9 = c(0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, NA, 1L, 1L, 1L),
IV = c(17L,46L,18L,23L,35L,10L,0L,19L,
15L,12L,21L,6L,27L,10L),
control1 = c(29.4,27.4,33.2,27.1,27.4,34.2,
26.8,32.9,26,26.3,27.3,33.4,23.5,31.3),
control2 = c(1.3,20,-0.2,3,3.4,0.3,-1.1,1.9,
-2,-1.6,2.8,1.9,2,1.8)
)
#> budget policyfactor1 policyfactor2 policyfactor3 policyfactor4 policyfactor5
#> 1 10.0 1 0 0 1 1
#> 2 8.0 1 1 1 0 0
#> 3 -7.0 0 0 1 1 1
#> 4 8.0 0 1 0 0 0
#> 5 3.0 0 0 1 0 0
#> 6 2.0 1 0 1 1 1
#> 7 0.5 1 1 1 NA 1
#> 8 1.5 0 1 0 NA 0
#> 9 -2.0 0 0 0 1 0
#> 10 -15.0 0 0 1 1 1
#> 11 30.0 1 1 1 0 1
#> 12 -0.5 0 0 1 1 0
#> 13 12.0 1 1 0 1 1
#> 14 18.0 1 0 0 0 1
#> policyfactor6 policyfactor7 policyfactor8 policyfactor9 IV control1 control2
#> 1 0 0 1 0 17 29.4 1.3
#> 2 1 1 0 0 46 27.4 20.0
#> 3 1 1 1 1 18 33.2 -0.2
#> 4 0 1 1 0 23 27.1 3.0
#> 5 1 1 NA 1 35 27.4 3.4
#> 6 1 0 1 0 10 34.2 0.3
#> 7 0 1 1 1 0 26.8 -1.1
#> 8 1 0 0 1 19 32.9 1.9
#> 9 1 1 0 0 15 26.0 -2.0
#> 10 1 0 1 1 12 26.3 -1.6
#> 11 0 0 0 NA 21 27.3 2.8
#> 12 1 1 0 1 6 33.4 1.9
#> 13 NA 0 1 1 27 23.5 2.0
#> 14 0 0 0 1 10 31.3 1.8
由reprex 包(v0.3.0)于 2020-06-20 创建