如何更改 Stargazer 中的显着性水平?

How to change significance levels in Stargazer?

问题

Stargazer 的显着性水平为 * p<0.1; ** p<0.05; ∗∗∗ p<0.01
但是,我希望显着性水平为 *p < 0.05, **p < 0.01, ***p <0.001

我发现了什么

stargazer documentation 中显示了如何编辑注释部分。但我也希望 table 中的星星对应于该更改。

MWE

不知道是否有必要,但我从 this 问题中偷走了这个,因为它非常接近我的实际代码。

library("stargazer"); library("lmtest"); library("sandwich")

set.seed(1234)
df <- data.frame(y=1001:1100)
df$x <- c(1:70,-100:-71) + rnorm(100, 0, 74.8)
model <- lm(log(y) ~ x, data=df)

test <- coeftest(model, vcov = vcovHC(model, type="HC3"))
ses <- test[, 2]
pvals <- test[, 4]
stargazer(model, type="text", p=pvals, se=ses)

经过一番搜索,我在这个R中找到了答案cheatsheet

Change the cutoffs for significance

Notice that temperature, quarter3, and quarter4 have each lost a gold star because we made it tougher to earn them.

stargazer(output, output2, type = "html", 
          star.cutoffs = c(0.05, 0.01, 0.001)) # star.cutoffs = NULL by default ```

现在我明白了它的作用,我意识到答案一直在 Stargazer manual 中:

star.cutoffs

a numeric vector that indicates the statistical signficance cutoffs for the statistical significance 'stars.' For elements with NA values, the corresponding 'star' will not be used.

所以答案毕竟是微不足道的,只需将 MWE 中的最后一行更改为:

stargazer(model, type="text", p=pvals, se=ses, c(0.05, 0.01, 0.001))