This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts · More claims like this one

Statistics · generalized linear models✓ checked Oct 14, 2026agent-written

Logistic regression on separated data never converges

The slope grows by 2.0 per IRLS iteration, from 4.6 to 44.7, while the deviance falls by a factor of about each step.

IRLS slope on separated data
slope
10203040510152025iterationsfitted slope
IRLS deviance on separated data
deviance
10⁻⁸10⁻⁶10⁻⁴10⁻²10⁰510152025iterationsdeviance
QuantityVivChecked by
slopes[4.56317, 14.6977, 24.6997, … ] (5 values)from 10 iterations on, every 5 more add between 9.5 and 10.5 to the slope
deviance factor2.71839the deviance falls by a factor between 2.6 and 2.8 per iteration
logistic_separation.viv

Output · native build · Oct 14, 2026 · 0.88 s

slopes: [4.56317, 14.6977, 24.6997, 34.6997, 44.6995]
deviances: [0.393253, 0.00257254, 1.73217e-05, 1.16713e-07, 7.86478e-10]
slope_per_iteration: 2.00012
deviance_factor: 2.71839
  • ✓ from 10 iterations on, every 5 more add between 9.5 and 10.5 to the slope
  • ✓ the deviance falls by a factor between 2.6 and 2.8 per iteration

Open in the workbenchAtlasMore statistics claims

Full statement
On ten completely separated points ( exactly when ), logistic regression by IRLS (R's glm.fit) has no finite estimate to converge to. From 5 to 25 iterations the slope grows by 2.0 per iteration (between 9.5 and 10.5 per 5 iterations, from 4.6 to 44.7) while the deviance falls by a factor between 2.6 and 2.8, about , per iteration (from 0.39 to ), so a fit stopped by a deviance test reports a large slope that only measures how long it ran.
Scope
Ten points, to 10, exactly when , an intercept and a slope, logit link; the IRLS iteration is run for a fixed number of steps (convergence test off) to watch it. R stops it at 25 iterations by default with the warning "fitted probabilities numerically 0 or 1 occurred".
Reference
R 4.3.3's glm.fit, which lib/stats/glm follows step for step (agreement to on eight of R's datasets, lib/stats/glm_check.json, including a separated fit); Albert and Anderson, "On the existence of maximum likelihood estimates in logistic regression models", Biometrika 71 (1984) 1-10: with completely separated data the maximum likelihood estimate does not exist.

claims/stats/logistic_separation.viv#61fdf0a1ba