Regression · Essentials

Logistic Regression

Fit a binary logistic regression with odds ratios, pseudo-R², classification accuracy, confusion matrix, and ROC-AUC.

In the menus Regression › Essentials › Logistic Regression

Also searched as logistic logit binary logistic regression binary logistic predict yes no predict a category classification regression odds ratios regression

When to use it

Predict a yes/no (binary) outcome from one or more numeric or categorical predictors, and quantify each effect as an odds ratio.

When not to: The outcome has more than two categories (use multinomial or ordinal logistic regression), the outcome is continuous (use linear regression), or a predictor perfectly separates the classes and its coefficient has diverged; the card will flag this and report no odds ratio for that term rather than a meaningless huge number.

Step by step

  1. Open it from the menu

    Click Regression in the menu bar; under Essentials choose Logistic Regression.

  2. Fill in the form

    Choose the columns: Yes/no outcome to predict, Columns that may explain it. The form lists only columns whose type fits each field. Then fill in Combined influences (optional), Compare categories against (optional), Predict for a new case (optional).

  3. Check the options

    The options start at their defaults: How strict to be, How sure the ranges are. Change one only when your question needs it.

  4. Run the analysis

    Press Run analysis. The Result Card opens on its Results tab.

What to choose in the form

Fields of the Logistic Regression form
Yes/no outcome to predict Response requiredOne binary or categorical or numeric column. A column with two values. The card names which value the chances are for.
Columns that may explain it Predictors requiredOne numeric or categorical or ordered categorical column. One or more columns, numbers or categories. Categories are coded automatically.
Combined influences (optional) InteractionsA value you type or choose on the form. Pairs of chosen columns whose link with the outcome may depend on each other. Leave empty if unsure.
Compare categories against (optional) Reference LevelsA value you type or choose on the form. For a category column, the level the others are compared with, written as column = level. Blank: the first level alphabetically.
Predict for a new case (optional) Predict AtA value you type or choose on the form. A value for every predictor of a case not in the table, written as column = value. The card adds its predicted chance.
How strict to be AlphaThe cut-off for the p-values. Below it, the card reports evidence for that column. Not sure? Keep 0.05. It is the usual convention in most fields.
How sure the ranges are Confidence levelThe confidence level of each odds ratio's range: 0.95 gives 95% confidence intervals. Not sure? Keep 0.95. It is the usual choice and matches a 0.05 cut-off.

How to read the card

The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.

What it assumes

Linearity

If it does not hold: Logistic regression assumes the predictors' effect is linear on the LOG-ODDS scale; if a continuous predictor's true relationship with the log-odds curves, the fitted coefficient is a compromise that misrepresents the effect at both ends of its range.

How to check: A Box-Tidwell-style check: a squared term for each continuous predictor is added and the augmented model is compared with the fitted one by a likelihood-ratio test (squared terms, not the classical x*ln(x) terms), reported directly on the card; reported as not testable when the augmented model fails to converge, and not applicable when every predictor is categorical.

Independence of observations

If it does not hold: Logistic regression assumes each row's outcome is independent given the predictors; clustered or repeated-measures data (multiple rows per subject) understate the true standard errors and overstate significance.

How to check: Not checked by KernelStats: no clustering or repeated-measures diagnostic is run; a clustered design needs a mixed-effects or GEE approach instead.

A worked example

Predicting penguin sex from body mass and bill depth, with species as a categorical covariate (reference level: Adelie).

Result: Positive class = male. Body mass OR = 1.0063 per gram (95% CI [1.0045, 1.0082], p < .001), i.e. about 1.88 per extra 100 g; bill depth OR = 5.44 per mm (95% CI [3.07, 9.65], p < .001); McFadden's R-squared = 0.65 (Tjur 0.71, Nagelkerke 0.79); ROC-AUC = 0.96; accuracy = 90% at the 0.5 threshold. The linearity-of-the-logit check flags curvature (LR test p = .038).

Both predictors are strongly associated with sex after adjusting for species, and the high ROC-AUC says the model ranks males above females well across all thresholds, not just at 0.5; McFadden's 0.65 is far above the 0.2-0.4 range usually called excellent for that measure. Two cautions travel with it: the AUC and accuracy are computed on the same rows the model was fit to, and the flagged linearity check suggests trying a curved term for body mass or bill depth before quoting a single per-unit odds ratio.

From the Statistics Library.

The code tabs

Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.

Understand the statistics

Ask Oobi

Type one of these into Ask Oobi beside your data:

  • Does body mass predict whether a penguin is female?
  • Explain the logistic regression in plain words.
  • What does odds ratio mean?

Last reviewed November 16, 2026.

Report an unclear step