I ran multiple logistic regressions based on a race_category variable using dplyr's group_by, and would like to obtain odds ratios rather than the standard output (e.g., coefficients).
I have a data frame upon which I want to predict an outcome given several variables, and wanted to determine whether there are any differences by race. I used dplyr to group by race category to run a logistic regression as follows:
r_models <- dat_hms22 %>%
group_by(race_category) %>%
do(model = glm(talk1_1 ~ stig_pcv_con + txfrf + stig_per_con + ther_help_me
+ meds_help_me + knowwher_temp + camp_supp + percneed + ther_ever,
data = ., family = binomial(logit)))
r_models$model
However, I would like to report the output as effect sizes using odds ratios.
Unfortunately, running the following line of code:
r_models %>% do(exp(cbind(OR = coef(.$model), confint(.$model))))
Resulted in the equivalent of a segfault, causing R Studio to reload, so any help would be appreciated.