1

Problem

Stargazer shows significance levels of ∗ p<0.1; ∗∗ p<0.05; ∗∗∗ p<0.01
However, I would like to have significance levels of *p < 0.05, **p < 0.01, ***p <0.001

What I found

In the stargazer documentation it is shown how to edit the notes section. But I would also like the stars in the table to correspond to that change.

MWE

Don't know if one is necessary, but I stole this from this question, since it is rather close to my actual code.

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)
nonthevisor
  • 143
  • 8

1 Answers1

2

After some more searching, I found the answer in this 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 ```

Now that I understood what it does, I realized that the answer was in the Stargazer manual all along:

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.

So the answer was trivial after all, just change the last line in the MWE to this:

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