Search code examples
rlogistic-regressionglm

How to find the odds ratios for a logistic model?


I have a standard logistic regression model in R

reg <- glm(formula = y ~ x, family = "binomial"(link='logit'))

I am trying to find the odds ratios for my model in R. Is there a function or some other way to do this?


Solution

  • The log odds ratio can be found by

    reg$coefficients
    

    ... and the odds ratio would be

    exp(reg$coefficients)
    

    ... the log of 2.5% and 97.5% levels of the confidence intervals would be

    confint.default(reg)
    

    ... following that the 2.5% and 97.% levels of the confidence intervals would be

    exp(confint.default(reg))