Description Usage Arguments Value Examples
Logistic regression table with odd ratios
1 | stargazer2(model, odd.ratio = FALSE, ...)
|
model |
A non-empty list containing one or more glm models |
odd.ratio |
A logical value indicating whether you want odd ratios (TRUE) instead of the usual log odds (FALSE). |
... |
further aguments passed to the stargazer function. See ?stargazer::stargazer |
A stargazer table with correct odd ratios, standard errors and p values
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | stargazer2(glm(am ~ mpg, data = mtcars), odd.ratio = TRUE, type = "text") # Odd ratios
stargazer2(glm(am ~ mpg, data = mtcars), odd.ratio = FALSE, type = "text") # Log odds
# Let's compare it with Stata output:
# R table
library(haven)
auto <- haven::read_dta("http://www.stata-press.com/data/r13/auto.dta")
auto$mpg2 <- auto$mpg > 21.29
model <- glm(mpg2 ~ price + rep78 + turn + displacement, data = auto, family = "binomial")
stargazer2(model, odd.ratio = TRUE, type = "text", single.row = TRUE)
# Stata table (run in Stata)
# use http://www.stata-press.com/data/r13/auto.dta, clear
# gen mpg2 = mpg > 21.29
# logit mpg2 price rep78 turn displacement, or
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.