Stats for

Generalized and Multilevel Regression

Logistic Regression

Logistic regression predicts a yes/no outcome from one or more predictors.

Logistic regression takes a yes/no outcome and one or more predictors of any type and tests how the odds of the outcome differ with each predictor, holding the others constant.

Example

Do belonging, study hours and first-generation status predict which first-year students drop out? We followed 400 first-year students, recording their sense of belonging on campus, weekly study hours and whether they were first-generation students, and whether each had left by the end of the year.

One Sample + Yes/No Outcome + One or More Predictors of Any Type → Logistic Regression
Tests
Population odds ratios (coefficients on the log-odds scale)
Observations
Independent
Parametric
Yes
Headline Statistic
\text{OR}
Effect Size
Odds Ratio
Groups
1

The Basics

When to Use It

Use it when your outcome is yes/no (it happened or it didn't), you have one or more predictors of any type measured on the same people, and you want to know how the odds of the outcome differ with each predictor while the others are held constant. For example:

  • Do belonging, study hours and first-generation status predict which first-year students drop out?
  • Do hopelessness scores and a history of self-harm predict readmission to a psychiatric unit within 30 days?
  • Do working-memory span and age predict whether children pass a false-belief task?

The model goes back to Cox (1958), who set it out for sequences of yes/no outcomes whose chance depends on other variables.

Vocabulary You Need

Definition Odds

The chance something happens divided by the chance it doesn't, p ÷ (1 − p). In a group, that's the number who had the outcome divided by the number who didn't. A proportion of .50 is odds of 1 (“1 to 1”), and .20 is odds of 0.25 (“1 to 4”). Unlike a proportion, odds run from 0 to infinity. Glossary →

Definition Log-Odds (\text{logit}(p))

The natural log of the odds, ln(p ÷ (1 − p)), also called the logit. A probability is stuck between 0 and 1 and odds between 0 and infinity, but log-odds run from minus to plus infinity, with 0 at a probability of .50: negative below it, positive above it, and symmetric, so .20 and .80 are −1.39 and +1.39. That unlimited scale is why logistic models are built on it: each predictor adds a fixed amount to the log-odds. A coefficient is a change in log-odds; e raised to it is an odds ratio, and 1 ÷ (1 + e^(−log-odds)) turns log-odds back into a probability. In a multinomial model the log-odds compare a category with the baseline category, ln(P(j) ÷ P(base)), rather than with everything else. Glossary →

Definition Odds Ratio (\text{OR})

One group's odds of an outcome divided by another group's. 1 means the odds are the same, 2 means the first group's odds are twice as high, and 0.5 means half as high; 0.5 and 2 are equally strong, in opposite directions. It's the usual effect size for a 2 × 2 table of two separate groups and what logistic regression reports. When the same people answer twice, as in McNemar's test, the paired odds ratio is different: it compares the people who switched one way with those who switched the other. It compares odds, not chances: when an outcome is common, the odds ratio is further from 1 than the ratio of the two proportions. A single zero cell, with the other counts positive, makes it 0 or infinite; more than one zero can leave it undefined. Glossary →

Definition Deviance (D)

How badly a model fits, measured as −2 × log-likelihood (for individual yes/no data; in general, relative to a model that fits every point perfectly). It plays the role the residual sum of squares plays in linear regression: 0 would be perfect prediction, and every predictor that helps brings it down. The null deviance belongs to a model with no predictors, which gives everyone the overall rate; the residual (or model) deviance belongs to the model with them. Only differences between deviances of nested models are interpretable, as likelihood-ratio χ² values; with one row per person, a model's own deviance isn't a test of its fit. Glossary →

Assumptions

1. Independent Observations The people (or other units) in your study don't influence each other.
What It Means
Each person's data comes from a separate, unconnected source, so knowing one person's scores tells you nothing about anyone else's. In designs that measure people more than once, their own scores are meant to be related; it's different people who must be independent. Methods built for clustered data, such as multilevel models and GEE, also allow members of the same group to be related, as long as the analysis names the grouping; then it's the groups that must be independent.
Applies To
Observations
How to Check
By design, not by a test. Did each person contribute their own data, with no clusters such as roommates, couples, therapy groups or classrooms whose members influence each other? If there are clusters, does the analysis model every one of them?
How Much It Matters
A lot. Students in the same residence hall, program or friendship group can share reasons for leaving; their outcomes are more alike than the model expects, the standard errors usually come out too small, especially for anything that differs between halls or programs, and the p-values too small with them.

If It's Violated

  • Alternative Test Multilevel Logistic Regression. A multilevel logistic regression, which adds a random effect for each cluster.
  • Alternative Test Generalized Estimating Equations (GEE). Generalized estimating equations, which keep the same odds ratios averaged over clusters and correct the standard errors.
  • Design Change Sample students independently, or record the cluster so it can be modeled.
2. Linearity of the Logit Each continuous predictor relates to the log-odds of the outcome in a straight line.
What It Means
The model assumes that each one-unit rise in a continuous predictor changes the log-odds of the outcome by the same amount, whether it happens low or high on the predictor's range. On the probability scale that's an S-shaped curve, so the probabilities themselves aren't expected to rise in a straight line. A U shape (risk that is high at both ends), a threshold or a leveling off breaks it. Yes/no predictors meet it automatically, since they have only two values.
Applies To
Relationship
How to Check
Add a bend and see whether it helps: a squared term, or a restricted cubic spline, for each continuous predictor, compared with the straight-line model by a likelihood-ratio test (Hosmer et al., 2013). The Box-Tidwell check adds x × ln(x) instead, for predictors with only positive values. A plot helps more than any p: cut the predictor into bands (such as deciles), and plot the log-odds of the outcome in each band against the band's average; the points should fall near a line.
How Much It Matters
A lot, for what the coefficients mean. One coefficient per predictor says students one point higher in belonging have odds lower by the same factor anywhere on the scale; if only very low belonging matters, that single odds ratio overstates the effect at the top of the scale and understates it at the bottom. In the dropout study, squared terms show no sign of a curve for belonging (p = .60) or study hours (p = .68), and Box-Tidwell terms, added for both at once, agree (p = .68 and .85). For the model as a whole, sort students into tenths by predicted chance and compare predicted with observed dropout in each: here they roughly track each other (Hosmer–Lemeshow χ²(8) = 11.17, p = .19, though the test has little power at this size; Hosmer et al., 2013). Then look for students with large standardized residuals or Cook's distances: the largest Cook's distance is .035, so no single student sways the coefficients.

If It's Violated

  • Correction Add a squared term or a restricted cubic spline for the predictor, and test it with a likelihood-ratio test. Report predicted probabilities across the range, since single coefficients no longer summarize the effect.
  • Transformation Log-transform a right-skewed predictor whose effect levels off, such as study hours. The odds ratio is then per unit of the log.
3. No Severe Multicollinearity Your predictors aren't so closely related that their effects can't be told apart.
What It Means
Each coefficient is estimated from the part of its predictor that doesn't overlap with the others. When predictors are highly correlated, that part is small, so the coefficients become unstable and their standard errors large, even though the model as a whole may predict well. Perfect overlap, such as including a total score and all of its parts, makes the model impossible to estimate.
Applies To
Predictors
How to Check
Look at the correlations among the predictors and at each predictor's variance inflation factor (VIF). A VIF near 1 means little overlap. Common cutoffs of 5 or 10 are rules of thumb, not tests (O'Brien, 2007); the real question is whether the coefficients you care about are still precise enough to interpret.
How Much It Matters
It depends on the question, as in linear regression: overlapping predictors don't hurt the model's predictions, but they inflate each coefficient's standard error. First-generation students report less belonging (r = −.35), yet the variance inflation factors are only 1.07 to 1.21, so the two coefficients can still be told apart. These VIFs come from the predictors alone, so any linear regression program will compute them; R's car::vif() on the fitted logistic model weights people by their fitted probabilities and gives slightly lower values. Either is fine.

If It's Violated

  • Design Change If two predictors measure the same thing, average them into one score or keep the one that fits your question.
  • Proceed with Caveat If you care only about the predictors jointly, report the likelihood-ratio test and predicted probabilities, and don't lean on the individual coefficients.
4. Enough Events, and No Perfect Prediction Your less common outcome happens often enough for the number of predictors you use.
What It Means
A yes/no model learns mostly from the people in the rarer category, so what counts is how many of them there are per estimated coefficient, not the total sample size alone. With too few, coefficients are biased (in either direction), their confidence intervals miss the true value more or less often than they should, and more of them come out significant in the wrong direction. The extreme case is separation: a predictor, or a combination, sorts people into outcomes perfectly (every student with a given profile dropped out, say). Then the best-fitting coefficient is infinite, and software either warns that fitted probabilities are 0 or 1 or reports a huge coefficient with an even huger standard error.
Applies To
Design
How to Check
Count the people in the rarer outcome category and divide by the number of coefficients you estimate, excluding the intercept but counting every dummy variable. At least 10 events per variable is a widespread rule of thumb (Peduzzi et al., 1996), but the evidence behind any fixed number is weak (van Smeden et al., 2016). Watch for warnings about fitted probabilities of 0 or 1, coefficients with enormous standard errors, and categories of a categorical predictor in which everyone (or no one) has the outcome.
How Much It Matters
A lot when events are scarce, none to speak of here. 80 of our 400 students dropped out, about 27 per predictor, well above the common rule of thumb of 10. No cell is empty (42 of 140 first-generation and 38 of 260 continuing-generation students dropped out), and every standard error is modest. With few events, maximum-likelihood coefficients are biased (Peduzzi et al., 1996); with separation, they don't exist at all.

If It's Violated

  • Robust Estimation Firth's (1993) correction shrinks the bias of small-sample estimates and gives finite estimates under separation (Heinze & Schemper, 2002). In R, the logistf package.
  • Design Change Plan the number of predictors around the number of events you expect, or collect more data.
  • Correction Use profile-likelihood intervals and likelihood-ratio tests rather than Wald ones when events are few; they don't assume the estimate's sampling distribution is symmetric.

Limitations

This Is Not Your Test If…

What It Doesn't Tell You

  • Why. "Holding constant" is arithmetic, not an experiment. Belonging was measured before anyone left, but students who were already struggling, financially or academically, may both feel they belong less and be more likely to leave.
  • Whether it matters. Significance doesn't make the model useful for spotting individual students: it removes only 6% of the deviance, and at the usual .5 cutoff it flags 4 of 400 students.
  • Who else. The odds ratios describe students like these 400 (simulated), at one kind of university, and depend on which predictors were included. Predicted probabilities also depend on the base rate: where 5% of students leave, the same odds ratios give much smaller chances.
  • That study hours don't matter. Their non-significant coefficient means the data can't pin the effect down, not that it's zero: students who study 5 more hours a week could plausibly have odds of dropping out 36% lower or 15% higher.

Common Mistakes

  • Don'tRead a coefficient as a change in probability.

    InsteadExponentiate it for an odds ratio, and show what it means with predicted probabilities at stated values.

  • Don'tJudge the model by the percentage it classifies correctly.

    InsteadCompare that percentage with the base rate, and report the area under the ROC curve alongside it. Accuracy at one cutoff is a poor yardstick for a model of chances (Harrell, 2017).

  • Don'tCheck the residuals for normality or equal spread.

    InsteadCheck independence, a straight line on the log-odds scale and enough events, then calibration and influential cases.

  • Don'tIgnore a warning that fitted probabilities are 0 or 1, or a coefficient with a huge standard error.

    InsteadLook for separation: a predictor or category that predicts the outcome perfectly. Use Firth's correction or rethink the predictors.

  • Don'tSplit a continuous outcome at a cutoff just so you can use logistic regression.

    InsteadKeep the score and use linear regression. Splitting throws away information and costs power.

  • Don'tRead an odds ratio of 3 as “three times as likely.”

    InsteadSay “three times the odds,” and give the two percentages so readers can see the actual chances.

  • Don'tRead a pseudo-R² as the share of variance explained, or compare it with a linear regression's R².

    InsteadName which pseudo-R² you report, and compare it only with the same kind from similar models.

  • Don'tRead a p-value as the chance that the null hypothesis is true.

    InsteadRead it as: if the null were true, how often data at least this extreme would turn up.

Result Decoder

Significance and Effect Size Guidelines

Benchmarks Significance (p Value)
  • p < .001

    Very strong evidence against the null hypothesis.

  • .001 ≤ p < .01

    Strong evidence against the null hypothesis.

  • .01 ≤ p < .05

    Statistically significant at α = .05. Moderate evidence against the null hypothesis.

  • .05 ≤ p < .10

    Not significant. Weak evidence; sometimes called a “trend.” Treat it as inconclusive.

  • p ≥ .10

    Not significant. Little evidence against the null, which is not the same as evidence of no effect.

These evidence labels are one common convention for describing p in graded language rather than as significant or not; the boundaries are rough guides, not rules, and other authors draw them differently. Muff et al. (2022) argue for this kind of language of evidence over a single cutoff. α is chosen before the analysis, and p never says how big or important an effect is.

More about statistical significance ↓

Benchmarks Effect Size (Odds Ratio)
  • 0.60 < OR < 1.68 Below Small

    Below the odds ratio that matches d = 0.2 when 1% of the comparison group has the outcome.

  • 1.68 ≤ OR < 3.47 (0.29 < OR ≤ 0.60) Small

    About d = 0.2 when 1% of the comparison group has the outcome.

  • 3.47 ≤ OR < 6.71 (0.15 < OR ≤ 0.29) Medium

    About d = 0.5 when 1% of the comparison group has the outcome.

  • OR ≥ 6.71 (OR ≤ 0.15) Large

    About d = 0.8 or more when 1% of the comparison group has the outcome.

For an odds ratio below 1, use its reciprocal (1 ÷ OR) or the bands in brackets. Chen, Cohen and Chen (2010) built these cutoffs for comparing two groups (a yes/no predictor, like first-generation status) when 1% of the comparison group has the outcome. Dropout is far more common (15% of continuing-generation students), and a common outcome needs a smaller odds ratio for the same Cohen's d, so here the labels understate each effect. For a continuous predictor the odds ratio also depends on the unit: per point of belonging it is 0.68, per standard deviation 0.65, and across two standard deviations 0.42. Say which unit you used, and judge the size in the study's own terms, with predicted probabilities.

More about effect size ↓

How It's Reported

Equation Form

Example

predicted dropout at average belonging and 12 study hours: p̂ = .15 (continuing-generation) and .25 (first-generation); belonging: OR = 0.68, 95% CI [0.52, 0.87], z = −3.00, p = .003; model: McFadden R2 = .06, χ2(3) = 25.58, p < .001

Table 1. Logistic Regression Predicting Dropout by the End of First Year

Example
bSEzpOR95% CI for OR
Intercept 0.3940.6310.62.532
Belonging (1–7) −0.3900.130−3.00.0030.68[0.52, 0.87]
Study hours a week −0.0300.030−1.00.3170.97[0.92, 1.03]
First-generation (1 = yes) 0.6120.2742.23.0251.84[1.08, 3.15]

Note. N = 400; 80 students (20%) dropped out. Likelihood-ratio χ2(3) = 25.58, p < .001; McFadden R2 = .06, Nagelkerke R2 = .10. b = coefficient on the log-odds scale; OR = odds ratio, eb, with a Wald 95% CI. Belonging is the coefficient worked through in the Napkin Math.

Full Text (APA Style)

Example

Of 400 first-year students, 80 (20%) had dropped out by the end of the year. Holding study hours and first-generation status constant, students with a stronger sense of belonging had lower odds of dropping out: each point on the 1–7 belonging scale went with 0.68 times the odds, OR = 0.68, 95% CI [0.52, 0.87], z = −3.00, p = .003. First-generation students had higher odds of dropping out than continuing-generation students with the same belonging and study hours, OR = 1.84, 95% CI [1.08, 3.15], z = 2.23, p = .025, while study hours did not add reliably to the prediction, OR = 0.97 per hour, 95% CI [0.92, 1.03], z = −1.00, p = .317. For a student with average belonging (4.5) who studied 12 hours a week, the model predicts a 15% chance of dropping out for a continuing-generation student and 25% for a first-generation student. Together the predictors improved modestly on the overall dropout rate, McFadden R2 = .06, and a likelihood-ratio test showed the model was statistically significant, χ2(3) = 25.58, p < .001.

  • Put every coefficient in a table like Table 1: b, its SE, z (or the Wald χ²) and p, and the odds ratio with its 95% CI, with the likelihood-ratio test and a named pseudo-R² underneath.
  • Give the unit for every odds ratio of a continuous predictor ("per point of belonging"), and say which interval you used (Wald or profile likelihood).
  • Translate the odds ratios into predicted probabilities for a few meaningful profiles of people; readers can't picture odds.
  • Say "odds," not "likely" or "risk," for an odds ratio, and "predicted" or "was associated with," not "increased" or "caused."

Reading Each Piece

The equation form above, piece by piece, in this order: how big, how certain, then how surprising.

p̂ = .15 (continuing-generation) and .25 (first-generation) Among students with average belonging who study 12 hours a week, the model expects about 15 in 100 continuing-generation students and 25 in 100 first-generation students to drop out. These describe groups of similar students, not a verdict on any one of them.
OR = 0.68 Each point higher on the 1–7 belonging scale goes with 0.68 times the odds of dropping out; turned around, a point lower goes with 1.48 times the odds. Per point (1.48 turned around), that's below the benchmarks' small range, and across two standard deviations of belonging (0.65 × 0.65 = 0.42) it's in the small range; but those cutoffs were built for comparing two groups on a rare outcome, and dropout is common, so they understate it. In probabilities, a first-generation student like the one above but with one standard deviation less belonging has a predicted 34% chance instead of 25%. Benchmarks ↑
95% CI [0.52, 0.87] Each point higher in belonging plausibly goes with odds of dropping out anywhere from 13% (0.87) to 48% (0.52) lower. The whole range is below 1. This is a Wald interval; the profile-likelihood interval R's confint() gives, [0.52, 0.87], agrees here.
McFadden R2 = .06 The predictors remove 6% of the misfit left by knowing only the overall dropout rate. That isn't 6% of the variance, and pseudo-R² values run lower than linear regression's R², so compare it only with the same measure from similar models. Most of what separates students who leave from those who stay isn't in this model.
z = −3.00, p = .003 Belonging's coefficient is 3.00 standard errors below zero. If belonging added nothing once study hours and first-generation status were known, a result this far out or further, in either direction, would turn up about 3 times in 1,000, so it's statistically significant. SPSS reports the same test as a Wald χ² of 9.01, which is z².
χ2(3) = 25.58, p < .001 The three predictors lower the deviance by 25.58. If none of them predicted dropout in the population, a drop at least this big would turn up about once in 85,000 samples. The 3 is the degrees of freedom, one per predictor.

Calculations

The Running Example

Example

The dropout study: 400 first-year students, three predictors (sense of belonging, weekly study hours, first-generation status) and one yes/no outcome, whether each had dropped out by the end of the year.

Null Hypothesis:
all three population coefficients are 0 (every odds ratio is 1)
Alternative:
at least one population coefficient is not 0

This is the null for the whole model: among students like these, none of the three predictors is related to the odds of dropping out, so the overall rate would predict as well as the model. Each predictor also gets its own test, whose null is that its coefficient is 0 (its odds ratio 1) with the other two held constant.

What Your Data Should Look Like

One row per person: the outcome coded 1 for the event you want the odds of (dropped out) and 0 otherwise, and one column per predictor. A categorical predictor goes in as 0/1 columns, one fewer than it has categories, and each column's odds ratio compares that category with the one you left out (the reference category). Check which value your software models: R and statsmodels model the 1s; SPSS models the higher code (check its Dependent Variable Encoding table). Below, a 0/1 column's M is its proportion, so .20 of students dropped out and .35 are first-generation.

Example
studentdropped_outbelongingstudy_hoursfirst_gen
104.214.20
212.48.11
312.614.91
403.214.11
505.012.71
606.016.60
… 394 more rows
MSD123
1. Dropped out (1 = yes)0.200.40
2. Belonging (1–7)4.501.10−.22
3. Study hours a week12.005.00−.10.26
4. First-generation (1 = yes)0.350.48.18−.35−.08

N = 400.

Correlations are Pearson r.

Simulated data.

Download all 400 rows (data.csv)

Napkin Math

The whole test, one idea at a time. Under each heading, a line says why the step matters, and the green note reads the equation in plain English with the dropout study's numbers. Collapse all to read just the headings: they tell the whole story on their own.

  1. 1. Turn the Share Who Dropped Out into Odds and Log-Odds

    Logistic regression doesn't predict the yes/no outcome directly. It works with the odds of a yes, and with their logarithm, the log-odds, which can take any value, so a straight-line equation never predicts an impossible chance.

    \text{logit}(p) = \ln\!\left(\dfrac{p}{1 - p}\right) =\ln\!\left(\dfrac{.20}{1 - .20}\right) = \ln(0.25)

    = −1.39

    p = .20

    \text{odds} = 0.25

    80 of our 400 students dropped out, so p = .20. The odds are .20 ÷ .80 = 0.25, one student leaving for every four who stayed, and the log-odds are ln(0.25) = −1.39. Negative log-odds just mean a chance below one half. ln is the natural log, the power you'd raise e (about 2.718) to; e^{x} undoes it, so e^{-1.39} = 0.25. Both are keys on any scientific calculator.

  2. 2. Find the Equation That Predicts Each Student's Log-Odds

    The model predicts each student's log-odds of dropping out as a starting value plus a weighted sum of their predictors. There's no formula for the best weights; software tries values, keeps whichever make the dropouts and stays we actually saw most probable, and repeats until they stop changing.

    \ln\!\left(\dfrac{\hat{p}}{1 - \hat{p}}\right) = b_0 + b_1 x_1 + b_2 x_2 + b_3 x_3 =0.394 - 0.390\,x_1 - 0.030\,x_2 + 0.612\,x_3

    b_0 = 0.394

    b_1 = −0.390

    b_2 = −0.030

    b_3 = 0.612

    x_1 is belonging, x_2 weekly study hours and x_3 first-generation status (1 = yes). This is maximum likelihood, done by iteration, which no napkin can hold, so we take the software's numbers. b_1 = −0.390 says students one point higher in belonging have log-odds of dropping out 0.39 lower, holding study hours and first-generation status constant. b_0 = 0.394 is the predicted log-odds when every predictor is 0, which here means belonging of 0, off the 1–7 scale. It only anchors the line, and its test in Table 1 isn't of interest; center the predictors (subtract their means) if you want an intercept you can read.

  3. 3. Turn One Student's Log-Odds into a Chance of Dropping Out

    Log-odds are hard to picture. Plugging a particular student into the equation and converting the result back into a probability shows what the model actually predicts, for someone we can describe.

    \hat{p} = \dfrac{1}{1 + e^{-\text{logit}}} =\dfrac{1}{1 + e^{1.72}}

    = .15

    \text{logit} = −1.72

    \hat{p}_{\text{first-gen}} = .25

    \hat{p}_{\text{first-gen, belonging 3.4}} = .34

    Take a continuing-generation student with average belonging (4.5) who studies 12 hours a week: 0.394 − 0.390 × 4.5 − 0.030 × 12 + 0.612 × 0 = −1.72 (using the unrounded b's). e^{1.72} is 5.59, and 1 ÷ (1 + 5.59) = .15, a 15% chance. Make the same student first-generation and the log-odds rise by 0.61 to −1.11, a 25% chance; drop their belonging to 3.4 as well and it's 34%.

  4. 4. Turn Belonging's Coefficient into an Odds Ratio

    A coefficient adds to the log-odds, which means it multiplies the odds: adding on the log scale is multiplying on the original scale, since e^{a + b} = e^{a} \times e^{b}. Raising e to the coefficient gives that multiplier, the odds ratio, the usual way to report a logistic regression.

    \text{OR} = e^{b_j} =e^{-0.390}

    = 0.68

    \text{OR}_{\text{per SD}} = 0.65

    \text{OR}_{\text{first-gen}} = 1.84

    b_1 is belonging's −0.390, and e^{-0.390} = 0.68: each point higher in belonging goes with 0.68 times the odds of dropping out, odds 32% lower, holding the other predictors constant. Per standard deviation of belonging (1.10 points) it's e^{-0.390 \times 1.10} = 0.65. First-generation status has an odds ratio of 1.84 (Table 1).

  5. 5. Give a Range of Plausible Values for Belonging's Odds Ratio

    Build the interval on the log-odds scale, where the estimate's uncertainty is symmetric, then convert both ends into odds ratios. That's why the interval isn't centered on 0.68.

    e^{\,b_j \,\pm\, z^{*} \times SE_{b_j}} =e^{\,-0.390 \,\pm\, 1.96 \times 0.130}

    = [0.52, 0.87]

    SE_{b_1} = 0.130

    SE_{b_1} is 0.130 and z^{*} = 1.96 holds the middle 95% of the normal curve. 1.96 × 0.130 = 0.255, so the coefficient's range is −0.390 ± 0.255, from −0.645 to −0.136. e^{-0.645} = 0.52 and e^{-0.136} = 0.87.

  6. 6. Test Whether Belonging Adds Anything Once the Others Are Known

    Each coefficient gets its own test, the coefficient divided by its standard error, judged against the normal curve. It asks whether belonging predicts dropout beyond what study hours and first-generation status already do.

    z = \dfrac{b}{SE_b} =\dfrac{-0.390}{0.130}

    = −3.00

    p = .003

    b_1 is belonging's −0.390 and SE_{b_1} is 0.130. −0.390 ÷ 0.130 = −3.00 standard errors. If belonging added nothing beyond the other two, a z at least that far from 0, in either direction, would turn up with probability .003.

  7. 7. Measure How Much Better the Model Fits Than the Overall Rate Alone

    The deviance measures how badly a model fits. Compare the model's deviance with the deviance of a model that gives every student the overall 20% chance; the share it removes is McFadden's pseudo-R squared.

    R^2_{\text{McF}} = 1 - \dfrac{LL_1}{LL_0} = 1 - \dfrac{D_1}{D_0} =1 - \dfrac{374.75}{400.32}

    = .06

    D_0 = 400.32

    D_1 = 374.75

    R^2_{\text{N}} = .10

    R^2_{\text{T}} = .07

    D_0 = 400.32 is the deviance when everyone gets the overall 20%; D_1 = 374.75 is what's left with the three predictors. 374.75 ÷ 400.32 = .936, so the predictors remove 1 − .936 = .06 of it. Nagelkerke's version, which SPSS prints, is .10, and Tjur's, the average predicted chance of students who left (.252) minus that of students who stayed (.187), is .07.

  8. 8. Ask Whether the Predictors Together Beat the Overall Rate Alone

    Even useless predictors lower the deviance a little by luck. The likelihood-ratio test asks whether the drop is bigger than chance would give, comparing it with a chi-square distribution with one degree of freedom per predictor.

    \chi^2 = D_0 - D_1, \quad df = k =400.32 - 374.75

    = 25.58

    p < .001

    D_0 - D_1 = 400.32 − 374.75 = 25.58, and k = 3 predictors gives 3 degrees of freedom. A χ² with 3 df lands at 25.58 or higher about once in 85,000 times, so p < .001.

  9. 9. Check How Often the Model Sorts Students Correctly, and Why That Misleads

    Software also reports how many people the model classifies correctly, calling everyone with a predicted chance of .5 or more a dropout. When one outcome is common, that number mostly reflects the base rate.

    \text{accuracy} = \dfrac{TP + TN}{n} =\dfrac{2 + 318}{400}

    = .80

    \text{Se} = .025

    \text{Sp} = .994

    \text{AUC} = .67

    Only 4 students get a predicted chance of .5 or more: 2 who left (TP) and 2 who stayed. Of the 396 called stayers, 318 stayed (TN) and 78 left. (2 + 318) ÷ 400 = .80, exactly what we'd get by predicting that nobody drops out. Sensitivity is 2 of 80, .025. The area under the ROC curve, .67, is a fairer summary: a randomly chosen dropout gets a higher predicted chance than a randomly chosen stayer 67% of the time.

Run It in Software

The code below reads the running example's data from data.csv; save it in the same folder you run the code from.

SPSS (version 30, as documented by IBM)
  1. Analyze → Regression → Binary Logistic.
  2. Move dropped_out into Dependent and belonging, study_hours and first_gen into Covariates. Leave Method on Enter.
  3. Options: check CI for exp(B) (95%). Leave the classification cutoff at 0.5. Click Continue, then OK.

Or paste this syntax:

LOGISTIC REGRESSION VARIABLES dropped_out
  /METHOD=ENTER belonging study_hours first_gen
  /PRINT=CI(95)
  /CRITERIA=PIN(.05) POUT(.10) ITERATE(20) CUT(.5).

Reading the Output

SPSS prints a Block 0 (no predictors) and a Block 1 section. In Block 1, read each predictor's Exp(B) and its 95% C.I. for EXP(B) in Variables in the Equation, then its Wald and Sig.; then the model's Nagelkerke R Square in Model Summary and the Chi-square and Sig. for Model in Omnibus Tests of Model Coefficients.

Omnibus Tests of Model Coefficients

Step 1 Chi-square df Sig.
Step 25.576 3 .000
Block 25.576 3 .000
Model 25.576 3 .000

Model Summary

Step -2 Log likelihood Cox & Snell R Square Nagelkerke R Square
1 374.746 .062 .098

Classification Table (cut value .500)

Observed Predicted: 0 Predicted: 1 Percentage Correct
dropped_out 0 318 2 99.4
dropped_out 1 78 2 2.5
Overall Percentage 80.0

Variables in the Equation

Step 1 B S.E. Wald df Sig. Exp(B) 95% C.I. Lower Upper
belonging -.390 .130 9.014 1 .003 .677 .524 .873
study_hours -.030 .030 1.003 1 .317 .971 .916 1.029
first_gen .612 .274 4.992 1 .025 1.843 1.078 3.152
Constant .394 .631 .391 1 .532 1.484

SPSS's Wald is z² (for belonging, −3.00² = 9.01), with the same p. "Sig. = .000" means p < .001. The Classification Table's 80.0% is the same as Block 0's, which predicts that nobody drops out: the model almost never reaches the .5 cutoff. SPSS prints Cox & Snell's and Nagelkerke's pseudo-R², not McFadden's; compute McFadden's from the Block 0 −2 log likelihood (400.322): 1 − 374.746 ÷ 400.322 = .064.

Output laid out from this page's computed results, not captured from a live run; labels and layout may differ slightly in your version.

R
dropout <- read.csv("data.csv")
fit <- glm(dropped_out ~ belonging + study_hours + first_gen,
           family = binomial, data = dropout)
summary(fit)

# Odds ratios with Wald 95% CIs
round(exp(cbind(OR = coef(fit), confint.default(fit))), 3)

# Profile-likelihood CIs, for comparison
round(exp(confint(fit)), 3)

# Likelihood-ratio test against the null model
null <- glm(dropped_out ~ 1, family = binomial, data = dropout)
anova(null, fit, test = "Chisq")

# McFadden's pseudo-R squared
1 - as.numeric(logLik(fit) / logLik(null))

# Predicted probabilities at meaningful values
profiles <- data.frame(belonging = 4.5, study_hours = 12, first_gen = c(0, 1))
predict(fit, newdata = profiles, type = "response")
Call:
glm(formula = dropped_out ~ belonging + study_hours + first_gen,
    family = binomial, data = dropout)

Coefficients:
            Estimate Std. Error z value Pr(>|z|)
(Intercept)  0.39448    0.63126   0.625  0.53203
belonging   -0.39044    0.13005  -3.002  0.00268 **
study_hours -0.02984    0.02980  -1.002  0.31656
first_gen    0.61158    0.27372   2.234  0.02546 *
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 400.32  on 399  degrees of freedom
Residual deviance: 374.75  on 396  degrees of freedom
AIC: 382.75

Number of Fisher Scoring iterations: 4

               OR 2.5 % 97.5 %
(Intercept) 1.484 0.431  5.113
belonging   0.677 0.524  0.873
study_hours 0.971 0.916  1.029
first_gen   1.843 1.078  3.152
Waiting for profiling to be done...
            2.5 % 97.5 %
(Intercept) 0.430  5.148
belonging   0.522  0.871
study_hours 0.913  1.027
first_gen   1.076  3.155
Analysis of Deviance Table

Model 1: dropped_out ~ 1
Model 2: dropped_out ~ belonging + study_hours + first_gen
  Resid. Df Resid. Dev Df Deviance Pr(>Chi)
1       399     400.32
2       396     374.75  3   25.576 1.17e-05 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
[1] 0.06388857
        1         2
0.1517900 0.2480472

summary() gives the coefficients on the log-odds scale; exponentiate them for odds ratios. confint.default() gives the Wald intervals this page uses, confint() the profile-likelihood ones, which agree to about two decimals here. The null and residual deviances at the bottom of the summary give the likelihood-ratio test by subtraction: 400.32 − 374.75 = 25.58 on 399 − 396 = 3 df, which anova() confirms.

Output from a real run: R 4.6.1 (stats), run 2026-09-29.

Python
import numpy as np
import pandas as pd
import statsmodels.formula.api as smf

dropout = pd.read_csv("data.csv")
fit = smf.logit("dropped_out ~ belonging + study_hours + first_gen", data=dropout).fit()
print(fit.summary())

# Odds ratios with Wald 95% CIs
print(np.exp(fit.params.to_frame("OR").join(fit.conf_int())).round(3))

print(fit.llr, fit.llr_pvalue)   # likelihood-ratio chi-square and its p
print(fit.prsquared)             # McFadden's pseudo-R squared

profiles = pd.DataFrame({"belonging": 4.5, "study_hours": 12, "first_gen": [0, 1]})
print(fit.predict(profiles))
Optimization terminated successfully.
         Current function value: 0.468432
         Iterations 6
                           Logit Regression Results
==============================================================================
Dep. Variable:            dropped_out   No. Observations:                  400
Model:                          Logit   Df Residuals:                      396
Method:                           MLE   Df Model:                            3
Date:                Sat, 03 Oct 2026   Pseudo R-squ.:                 0.06389
Time:                        15:07:47   Log-Likelihood:                -187.37
converged:                       True   LL-Null:                       -200.16
Covariance Type:            nonrobust   LLR p-value:                 1.170e-05
===============================================================================
                  coef    std err          z      P>|z|      [0.025      0.975]
-------------------------------------------------------------------------------
Intercept       0.3945      0.631      0.625      0.532      -0.843       1.632
belonging      -0.3904      0.130     -3.002      0.003      -0.645      -0.136
study_hours    -0.0298      0.030     -1.002      0.317      -0.088       0.029
first_gen       0.6116      0.274      2.234      0.025       0.075       1.148
===============================================================================
                OR      0      1
Intercept    1.484  0.431  5.113
belonging    0.677  0.524  0.873
study_hours  0.971  0.916  1.029
first_gen    1.843  1.078  3.152
25.575998072952245 1.1699839702099807e-05
0.06388857464649933
0    0.151790
1    0.248047
dtype: float64

"Pseudo R-squ." is McFadden's. The log-likelihoods are half the deviances with the sign flipped: −2 × −200.16 = 400.32. The summary's intervals are Wald intervals for b; exponentiate them for the odds ratios.

Output from a real run: Python 3.9.6 (statsmodels 0.14.6, numpy 2.0.2, pandas 2.3.3), run 2026-10-03.

Impact

Effect Size

A logistic regression has effect sizes at two levels. For each predictor, the odds ratio says how many times the odds of the outcome are multiplied per unit, holding the other predictors constant; predicted probabilities put the same result in terms anyone can picture. For the whole model, a pseudo-R² summarizes how much the predictors improve on the overall rate.

\text{OR} = e^{b_1} = e^{-0.390} = 0.68

Each extra point of belonging on the 1–7 scale goes with 0.68 times the odds of dropping out, and first-generation students have 1.84 times the odds of continuing-generation students with the same belonging and study hours. For a student with average belonging who studies 12 hours a week, that's the difference between a 15% and a 25% chance of leaving.

An odds ratio for a continuous predictor depends on its unit: per point of belonging it's 0.68, per standard deviation 0.65. Say which, and compare predictors in comparable units. First-generation status is also a reminder that odds ratios depend on what else is in the model: on its own, first-generation students' odds of leaving were 2.50 times higher (30% vs 15% left); holding belonging and study hours constant shrinks that to 1.84, mostly because first-generation students report less belonging (with belonging alone added, it's 1.83). Unlike a linear regression slope, an odds ratio can also move when you add a predictor that's unrelated to the others, as long as it predicts the outcome (Mood, 2010), so a change between models isn't by itself evidence of confounding. To compare models, compare predicted probabilities. The same goes for an interaction: an interaction on the log-odds scale can be bigger, smaller or even absent in chances, so show it with predicted probabilities for each combination.

The three pseudo-R² values tell the same story at different sizes: McFadden's .06, Tjur's .07 and Nagelkerke's .10 (McFadden, 1974; Tjur, 2009; Nagelkerke, 1991). None is a share of variance explained, and none has agreed benchmarks. Benchmarks for odds ratios are conventions too. Whether a 10-point gap in predicted dropout between otherwise similar first- and continuing-generation students matters is a question for the university, not statistics.

Benchmarks Odds Ratio at a Glance
Below Small
0.60 < OR < 1.68
Small
1.68 ≤ OR < 3.47 (0.29 < OR ≤ 0.60)
Medium
3.47 ≤ OR < 6.71 (0.15 < OR ≤ 0.29)
Large
OR ≥ 6.71 (OR ≤ 0.15)

Full benchmarks and caveats ↑

Statistical Significance

A logistic regression answers two kinds of significance question. The likelihood-ratio test's p asks: if none of the predictors had any relationship with the outcome in the population, how often would adding them lower the deviance at least this much? Each coefficient's Wald z test asks: if this predictor added nothing once the others were known, how often would its coefficient land at least this far from zero, in either direction? Below the conventional α = .05, a result is called statistically significant.

If belonging, study hours and first-generation status predicted nothing, a drop in deviance of 25.58 would turn up about once in 85,000 samples (p < .001). If belonging added nothing beyond the other two, a coefficient this far from zero would turn up about 3 times in 1,000 (p = .003). Study hours' p of .317 means the data can't rule out that they add nothing beyond the other two predictors. It doesn't show their contribution is small: the interval still includes sizable effects in both directions (see What It Doesn't Tell You).

The same test can be run as a likelihood-ratio test for one predictor, by comparing the model with and without it. In large samples like this one the two versions agree closely; Wald tests and intervals are what SPSS and statsmodels print, and R's confint() gives profile-likelihood intervals built from the likelihood instead.

p is not the probability that a predictor is useless, and it says nothing about how much a predictor matters: with thousands of students, a trivially small odds ratio would be significant too. Each coefficient's test also depends on which other predictors are in the model. That's what the odds ratios, intervals and predicted probabilities are for.

Benchmarks p at a Glance
Very Strong
p < .001
Strong
.001 ≤ p < .01
Significant
.01 ≤ p < .05
Weak
.05 ≤ p < .10
Little
p ≥ .10

Strength of evidence against the null hypothesis.

Full benchmarks and caveats ↑

Power and Sample Size

Power is the chance that a study detects an effect that's really there. A real effect doesn't guarantee a significant result: with too few people, it can easily come out non-significant. For a logistic regression, power depends on the odds ratio you're looking for, how common the outcome is (a rare outcome carries less information per person), how spread out the predictor is, how much it overlaps with the other predictors, how many people you have, and α.

Unlike a t-test, there's no exact formula, only approximations (Hsieh et al., 1998), and this page has no calculator for it. Two practical routes: G*Power, which added a procedure for logistic regression in version 3.1 (Faul et al., 2009); or simulation, which is what we did below: invent data from the model you expect, analyze it thousands of times, and count how often the result comes out significant.

Suppose, before collecting data, we'd expected the odds ratios we found: 0.68 per point of belonging and 1.84 for first-generation status, with 20% of students leaving. Simulating 4,000 studies of 400 students each, belonging's coefficient came out significant about 86% of the time, and about 350 students would have given 80%. First-generation status is another story: at 400 students it came out significant only about 61% of the time, and 80% would take about 650. A study this size could easily have missed it.

A common rule of thumb asks for at least 10 events (people in the rarer outcome category) per predictor (Peduzzi et al., 1996); our 80 dropouts across 3 predictors give about 27. It guards against biased estimates, not low power, and the evidence for any fixed number is weak (van Smeden et al., 2016), so treat it as a floor, not a plan.

Researchers usually aim for at least 80% power. Plan it before collecting data, for the smallest odds ratio that would matter, for the specific predictor you'll interpret, and at the outcome rate you realistically expect.

Other Info

Follow-Up and Post Hoc Tests

None needed. This test answers a single question, so there are no planned contrasts or post hoc tests to run.

References

  • Cox, D. R. (1958). The regression analysis of binary sequences. Journal of the Royal Statistical Society: Series B (Methodological), 20(2), 215–232. https://doi.org/10.1111/j.2517-6161.1958.tb00292.x
    “A sequence of 0’s and 1’s is observed and it is suspected that the chance that a particular trial is a 1 depends on the value of one or more independent variables.” (Summary)
  • Hosmer, D. W., Lemeshow, S., & Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Wiley. https://doi.org/10.1002/9781118548387
  • Firth, D. (1993). Bias reduction of maximum likelihood estimates. Biometrika, 80(1), 27–38. https://doi.org/10.1093/biomet/80.1.27
  • Mood, C. (2010). Logistic regression: Why we cannot do what we think we can do, and what we can do about it. European Sociological Review, 26(1), 67–82. https://doi.org/10.1093/esr/jcp006
  • Hsieh, F. Y., Bloch, D. A., & Larsen, M. D. (1998). A simple method of sample size calculation for linear and logistic regression. Statistics in Medicine, 17(14), 1623–1634. https://doi.org/10.1002/(SICI)1097-0258(19980730)17:14<1623::AID-SIM871>3.0.CO;2-S
  • Harrell, F. E., Jr. (2017, March 1). Damage caused by classification accuracy and other discontinuous improper accuracy scoring rules [Blog post]. Statistical Thinking. https://www.fharrell.com/post/class-damage/
    “Classification accuracy is a discontinuous scoring rule.” (Main text, paragraph beginning “Classification accuracy is a discontinuous scoring rule”)
  • Faul, F., Erdfelder, E., Buchner, A., & Lang, A.-G. (2009). Statistical power analyses using G*Power 3.1: Tests for correlation and regression analyses. Behavior Research Methods, 41(4), 1149–1160. https://doi.org/10.3758/BRM.41.4.1149
    “(5) logistic regression, and (6) Poisson regression” (Abstract)
  • Chen, H., Cohen, P., & Chen, S. (2010). How big is a big odds ratio? Interpreting the magnitudes of odds ratios in epidemiological studies. Communications in Statistics—Simulation and Computation, 39(4), 860–864. https://doi.org/10.1080/03610911003650383
    “OR = 1.68, 3.47, and 6.71 are equivalent to Cohen's d = 0.2 (small), 0.5 (medium), and 0.8 (large), respectively, when disease rate is 1% in the nonexposed group” (Abstract)
  • McFadden, D. (1974). Conditional logit analysis of qualitative choice behavior. In P. Zarembka (Ed.), Frontiers in econometrics (pp. 105–142). Academic Press. https://eml.berkeley.edu/reprints/mcfadden/zarembka.pdf
    “we can define a coefficient of determination that is analogous to the multiple-correlation coefficient in the linear statistical model” (p. 121)
  • Nagelkerke, N. J. D. (1991). A note on a general definition of the coefficient of determination. Biometrika, 78(3), 691–692. https://doi.org/10.1093/biomet/78.3.691
    “A generalization of the coefficient of determination R2 to general regression models is discussed.” (Abstract)
  • Tjur, T. (2009). Coefficients of determination in logistic regression models—A new proposal: The coefficient of discrimination. The American Statistician, 63(4), 366–372. https://doi.org/10.1198/tast.2009.08210
    “namely the difference between the averages of fitted values for successes and failures, respectively” (Abstract)
  • Wilks, S. S. (1938). The large-sample distribution of the likelihood ratio for testing composite hypotheses. The Annals of Mathematical Statistics, 9(1), 60–62. https://doi.org/10.1214/aoms/1177732360
  • Muff, S., Nilsen, E. B., O'Hara, R. B., & Nater, C. R. (2022). Rewriting results sections in the language of evidence. Trends in Ecology & Evolution, 37(3), 203–210. https://doi.org/10.1016/j.tree.2021.10.009
    “we suggest language of evidence that allows for a more nuanced approach to communicate scientific findings as a simple and intuitive alternative to statistical significance testing” (Abstract)
  • Box, G. E. P., & Tidwell, P. W. (1962). Transformation of the independent variables. Technometrics, 4(4), 531–550. https://doi.org/10.1080/00401706.1962.10490038
  • O'Brien, R. M. (2007). A caution regarding rules of thumb for variance inflation factors. Quality & Quantity, 41(5), 673–690. https://doi.org/10.1007/s11135-006-9018-6
  • Peduzzi, P., Concato, J., Kemper, E., Holford, T. R., & Feinstein, A. R. (1996). A simulation study of the number of events per variable in logistic regression analysis. Journal of Clinical Epidemiology, 49(12), 1373–1379. https://doi.org/10.1016/S0895-4356(96)00236-3
    “For EPV values of 10 or greater, no major problems occurred.” (Abstract)
  • van Smeden, M., de Groot, J. A. H., Moons, K. G. M., Collins, G. S., Altman, D. G., Eijkemans, M. J. C., & Reitsma, J. B. (2016). No rationale for 1 variable per 10 events criterion for binary logistic regression analysis. BMC Medical Research Methodology, 16, 163. https://doi.org/10.1186/s12874-016-0267-3
    “The current evidence supporting EPV rules for binary logistic regression is weak.” (Abstract, Conclusions)
  • Heinze, G., & Schemper, M. (2002). A solution to the problem of separation in logistic regression. Statistics in Medicine, 21(16), 2409–2419. https://doi.org/10.1002/sim.1047
    “Separation primarily occurs in small samples with several unbalanced and highly predictive risk factors.” (Abstract)

Spot an error? Something still confusing? Tell us at support@statsforpsychology.com.