1. Learn
  2. /
  3. Courses
  4. /
  5. Generalized Linear Models in R

Connected

Exercise

Extracting and interpreting odds-ratios

You looked at the bus data in this chapter and in chapter 2. During this exercise, you are going to extract out the odds-ratio ratio from a model that predicts the chance of riding the bus based upon number of commuting days. The resulting odds-ratio (indicated by the CommuteDays term) will give you the change in odds for each extra day a person commutes. For example, an odds-ratio of 1.5 would mean each extra-day a person commutes per week, the odds increase 50% (1.5 - 1.0 = 0.5 = 50%) they will ride the bus.

A logistic regression, bus_out has been fit for you.

Instructions 1/2

undefined XP
    1
    2
  • Using base R, extract out the regression coefficients using coef() and save this a coef_out.
  • Convert these coefficients to odds-ratios by calculating the exponential of the results with exp().