I like Stargazer quite a bit but am running into some issues trying to report standard errors and confidence intervals all in a single table.
Consider this simple regression as a reproducible example:
set.seed(04152020)
x <- rnorm(100)
y <- 2*x + rnorm(100)
m1 <- lm(y~x)
I can report standard errors and confidence intervals in two separate tables no problem using the ci
option.
library(stargazer)
# standard errors
stargazer(m1, type = "text")
# confidence intervals
stargazer(m1, ci = FALSE, type = "text")
A workaround to get them into a single table is to "report" the model twice, but then the coefficients are repeated unnecessarily. For example, the following code:
stargazer(list(m1, m1),
ci = c(FALSE, TRUE),
type = "text")
Produces:
==========================================================
Dependent variable:
----------------------------
y
(1) (2)
----------------------------------------------------------
x 1.981*** 1.981***
(0.110) (1.766, 2.196)
Constant -0.218** -0.218**
(0.104) (-0.421, -0.014)
----------------------------------------------------------
Observations 100 100
R2 0.769 0.769
Adjusted R2 0.766 0.766
Residual Std. Error (df = 98) 1.032 1.032
F Statistic (df = 1; 98) 325.893*** 325.893***
==========================================================
Note: *p<0.1; **p<0.05; ***p<0.01
Is there a way to put both standard errors and confidence intervals into a single column automatically, like you can do with p-values? E.g. this code:
stargazer(m1,
ci = c(FALSE, TRUE),
report = ('vcsp'),
type = "text")
Produces exactly what I want, but with p-values, and the documentation for the option that allows for it—report
—seems to only allow the choice for p-values, as indicated by this question and answer.
===============================================
Dependent variable:
---------------------------
y
-----------------------------------------------
x 1.981
(0.110)
p = 0.000
Constant -0.218
(0.104)
p = 0.039
-----------------------------------------------
Observations 100
R2 0.769
Adjusted R2 0.766
Residual Std. Error 1.032 (df = 98)
F Statistic 325.893*** (df = 1; 98)
===============================================
Note: *p<0.1; **p<0.05; ***p<0.01