My Academic TutorLearn with understanding.
Menu
R & STATISTICAL PROGRAMMING · LEARNING GUIDE

Logistic regression in R: from glm() output to odds ratios

Fit a binary-outcome model in R and translate coefficients into interpretable odds ratios and predicted probabilities.

Fit the binary model

A standard model can be fitted with glm(outcome ~ predictor1 + predictor2, data = dat, family = binomial). The outcome should encode the event and non-event consistently so you know which probability is being modelled.

The default logit link models the log-odds of the event as a linear predictor.

Convert coefficients to odds ratios

coef(model) returns log-odds coefficients. exp(coef(model)) converts them to odds ratios. An odds ratio above one indicates higher odds for a one-unit predictor increase or relative to a reference category; below one indicates lower odds.

Use exp(confint(model)) or an appropriate confidence-interval method to express uncertainty on the odds-ratio scale.

Predicted probabilities

predict(model, newdata = ..., type = 'response') returns fitted probabilities for specified predictor values. This can make the model easier to explain because probabilities are on a 0-to-1 scale.

When comparing predicted probabilities, clearly state which other predictors are being held fixed and whether the chosen covariate pattern is meaningful.

Do not stop at the coefficient table

Check the coding of categorical variables, influential observations, non-linearity of continuous predictors on the logit scale and whether the model has enough information for the number of parameters being estimated.

Model performance and calibration matter for prediction; confounding and model specification matter for explanatory or causal questions.

Use this actively

Close the guide and explain the main idea without looking back. Then work through a fresh example. The first step you cannot explain is usually the best place to focus your next revision session.

About this guide: Educational content from My Academic Tutor. It is intended to support understanding and independent study, not replace course-specific teaching, supervision or assessed work.

Read our Learning Hub editorial approach