stargazer2: Logistic regression table with odd ratios

Description Usage Arguments Value Examples

View source: R/stargazer2.R

Description

Logistic regression table with odd ratios

Usage

1
stargazer2(model, odd.ratio = FALSE, ...)

Arguments

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

Value

A stargazer table with correct odd ratios, standard errors and p values

Examples

 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

cimentadaj/cimentadaj documentation built on Dec. 1, 2019, 5:22 p.m.