0

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?

TylerH
  • 20,799
  • 66
  • 75
  • 101
324
  • 702
  • 8
  • 28
  • The title of this question has to do with reporting. The body of this question seems to be about whether there's a good function or way to calculate odds ratios of a model. – Galen Apr 29 '20 at 17:44
  • @Galen sorry for the confusion... the title has been updated – 324 Apr 29 '20 at 17:46
  • This post seems useful: https://stats.stackexchange.com/questions/8661/logistic-regression-in-r-odds-ratio – Anders Ellern Bilgrau Apr 29 '20 at 17:48

2 Answers2

6

This is a good way to find the odds ratios

exp(coef(reg))

TylerH
  • 20,799
  • 66
  • 75
  • 101
3

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))
pha
  • 316
  • 2
  • 9