Logistic Regression & Odds Ratios

Logistic regression in R β€” fit a binary-outcome model with glm(), report adjusted odds ratios with gtsummary, and measure discrimination with a ROC curve and AUC.

Model a yes/no outcome and report it the way clinical papers do.

Run the code

Everything in the video β€” edit it and press Run Code to run real R right here, or copy it:

Note

The first Run Code installs the packages this lesson needs (gtsummary, pROC) into your browser session β€” give it 20–40 seconds (gtsummary is large β€” if it is slow in the browser, download the R script and run it locally).

Download this R script  Β·  β–Ά Open the full playground

When to use it. Use it for a binary outcome; exponentiate the coefficients to get odds ratios, and judge the model with the ROC curve and AUC.

Go deeper: the Clinical R Toolkit Β· read logistic regression, OR & ROC.

Next: Kaplan-Meier Survival Curves β†’