Created
March 6, 2017 09:16
-
-
Save scoavoux/ccb2f4333626949838a0ff807da238ff to your computer and use it in GitHub Desktop.
Compute odds.ratio and p.value for logit model report in stargazer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sg_or <- function(mod){ | |
OR <- lapply(mod, function(x) as.data.frame(questionr::odds.ratio(x))) | |
re <- list( | |
or = lapply(OR, `[[`, "OR"), | |
ci = lapply(OR, `[`, 2:3), | |
p = lapply(OR, `[[`, "p") | |
) | |
return(re) | |
} | |
# mod <- glm(..., family = "binomial") | |
# custom_coef <- sg_or(mod) | |
# stargazer(mod, ci = TRUE, | |
# coef = custom_coef$or, | |
# ci.custom = custom_coef$ci, | |
# p = custom_coef$p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment