In our last session, you learned the fundamentals of logistic regression, a powerful tool for modeling binary outcomes common in your field of interest, such as patient survival or treatment response. We focused on fitting these models in R with glm() and interpreting the raw output: the coefficients on the log-odds (or logit) scale. While mathematically sound, log-odds are not intuitive for communicating findings.
This lesson bridges that gap. We will convert those log-odds into odds ratios (ORs), the standard for reporting logistic regression results in medical and epidemiological research. You will learn the 'why' and 'how' of this transformation, master the interpretation of ORs for different types of predictors, and see how they are presented in publication-quality tables and plots. This skill is absolutely essential for translating your statistical models into clear, actionable insights for your future research papers and clinical reports.
From Log-Odds to a More Intuitive Measure
In the previous lesson, we established that logistic regression models a linear relationship between your predictors and the log-odds of the outcome:
The key to a more intuitive interpretation lies in getting rid of the natural logarithm (). We can do this by exponentiating both sides of the equation. If we consider the effect of a single predictor , the odds ratio for a one-unit increase in is calculated as:
This gives us a simple, powerful rule: the odds ratio for a predictor is the exponentiated value of its coefficient. In R, this is just exp(coefficient).
The following short video provides a concise explanation of what an odds ratio is and how to interpret its value relative to 1.
Logistic Regression I | Statistics for Applied Epidemiology | Tutorial 5
This clip from the MarinStatsLectures channel offers a clear, foundational definition of odds and odds ratios, which is a concept you'll frequently encounter in epidemiological literature.
Please watch the segment from this section. It explains the meaning of an odds ratio being greater than, less than, or equal to one.
The three key interpretation rules are:
- OR > 1: The predictor is associated with increased odds of the outcome (a risk factor).
- OR < 1: The predictor is associated with decreased odds of the outcome (a protective factor).
- OR = 1: The predictor has no association with the odds of the outcome.
Calculating Odds Ratios in R
There are two primary ways to calculate odds ratios in R. Let's assume you have a fitted model object, for instance: my_model <- glm(outcome ~ predictor1 + predictor2, data = df, family = "binomial").
1. Using Base R exp()
You can extract the coefficients using coef() and then exponentiate them. This is a straightforward way to see the direct transformation. To get the confidence intervals for these ORs, you can do the same with the confint() function.
# Get the odds ratios
exp(coef(my_model))
# Get the 95% confidence intervals for the odds ratios
exp(confint(my_model))
This approach is useful for a quick calculation, but it separates the estimate from its confidence interval.
2. Using broom::tidy()
A more integrated approach, especially within a tidyverse workflow, is to use the broom package. We previewed this in the last lesson. By adding the argument exponentiate = TRUE, the tidy() function will do the conversion for you and return a neat data frame with the odds ratios and their corresponding confidence intervals.
This method is highly recommended as it provides all the necessary information in one tidy structure. Let's see it in practice.
Chapter 33 Logistic Regression and Broom for Tidying Models
This section from "Reproducible Medical Research with R" demonstrates the most common and effective way to get odds ratios from your model.
In the text, find the part where the author reruns broom::tidy(). Read the section starting from this paragraph to see the code broom::tidy(exp = TRUE). Then, carefully study the interpretation provided for the resulting odds ratios, especially how values less than one and greater than one are described here.
Interpreting Odds Ratios in Context
The phrasing of your interpretation depends on whether the predictor is continuous or categorical. Getting this right is crucial for clear communication in a research context.
Continuous Predictors (e.g., Age)
For a continuous variable, the OR represents the change in odds for a one-unit increase in the predictor.
- Example: If the OR for
ageis 1.05, the interpretation is: "For each additional year of age, the odds of having the disease increase by 5% (or are multiplied by a factor of 1.05), holding other variables constant."
This short clip explains this interpretation clearly.
LOGIT REGRESSION IN R: ODDS RATIO INTERPRETATIONS!!! #1.4
This video from Quantitative Social Science Data Analysis provides excellent, concise phrasing for interpreting an OR from a continuous variable.
Watch the segment from this clip. Pay close attention to the "for a one unit increase" phrasing.
Categorical Predictors (e.g., Sex, Treatment Group)
For a categorical variable, the OR compares the odds of the outcome for one level of the variable against the reference level.
- Example: If your model includes
sex(with "Male" as the reference level) and the OR for thesexFemalecoefficient is 0.7, the interpretation is: "The odds of having the disease for females are 0.7 times the odds for males (or 30% lower), holding other variables constant."
This tutorial walks through the interpretation for both binary and continuous variables with clear examples.
Logistic Regression I | Statistics for Applied Epidemiology | Tutorial 5
This MarinStatsLectures video is tailored for an epidemiology audience and gives excellent examples of interpreting ORs in a health context.
First, watch how to interpret the OR for a binary predictor from this segment. Then, watch the explanation for a continuous predictor from the next segment. Notice the precise language used for "times the odds" versus a percentage increase.
Reporting Odds Ratios: Tables and Plots
In your future work, you won't just be interpreting ORs in your head; you'll be presenting them in papers and reports.
Publication-Ready Tables
Manually creating regression tables is tedious and error-prone. Thankfully, there are packages that automate this. The gtsummary package is fantastic for this, and it works seamlessly with broom. You can create a beautifully formatted table with odds ratios, confidence intervals, and p-values with a single line of code.
# First, install the package if you haven't already
# install.packages("gtsummary")
library(gtsummary)
# Create a publication-ready table from your model
tbl_regression(my_model, exponentiate = TRUE)
This command produces a table that you could almost copy-paste directly into a manuscript. The resource below shows an example of such a table.
Binary logistic regression in R - Stats and R
The blog "Stats and R" provides an excellent overview of logistic regression and introduces powerful reporting tools.
Scroll down to the section "Reporting results" and find the subsection "{gtsummary} package". Look at the code and resulting table. This demonstrates the power of using tbl_regression(exponentiate = TRUE) to generate a professional summary.
Visualizing with Forest Plots
A forest plot is a standard way to visualize odds ratios and their confidence intervals. This is especially useful when comparing multiple effects or results from different models.

From this plot, you can see at a glance:
- The effect estimate (the point).
- The precision of the estimate (the width of the confidence interval).
- The statistical significance (whether the interval crosses the vertical line at 1.0).
For example, in model m2, the SexFemale effect is large and its confidence interval is far from 1.0, indicating a significant association. In contrast, for Class2nd, the confidence intervals for both models are close to and cross 1.0, suggesting a non-significant or weak association.
Conclusion
You have now completed the essential step of making your logistic regression models interpretable. By converting log-odds to odds ratios, you can communicate your findings in a way that is standard, intuitive, and directly applicable to a clinical or research audience.
Key Takeaways:
- The odds ratio (OR) is calculated by exponentiating the logistic regression coefficient:
OR = exp(β). - An OR > 1 indicates increased odds, while an OR < 1 indicates decreased odds of the outcome. An OR of 1 indicates no association.
- In R, you can use
exp(coef(model))or, more effectively,broom::tidy(model, exponentiate = TRUE)to get ORs and their confidence intervals. - Interpretation phrasing is key: "for a one-unit increase..." for continuous variables, and "...compared to the reference group" for categorical variables.
- For reporting,
gtsummary::tbl_regression()creates professional tables, and forest plots provide an excellent visual summary of results.
Preview of the Next Lesson:
We have already seen how incredibly useful the broom package is for tidying model output. In the next lesson, we will formalize its use. You will learn to systematically use broom::tidy() to extract coefficient-level information and broom::glance() to get model-level summary statistics (like AIC). Mastering broom is a cornerstone of a reproducible and scalable data analysis workflow in R.