Get Started →
Modeling & Regression Errors

Fitted probabilities 0 or 1

Matches: fitted probabilities numerically 0 or 1

WHAT THIS ERROR MEANS

In logistic regression, some predicted probabilities are extremely close to 0 or 1, indicating perfect or near-perfect separation. A predictor perfectly separates the outcome.

HOW TO FIX IT

1. Investigate which predictor causes perfect separation.

2. Remove or combine the problematic predictor.

3. Use penalized regression (e.g., glmnet) to handle separation.

4. Consider if your model is overfit.

CODE EXAMPLES

BAD — THIS CAUSES THE ERROR
# x perfectly predicts y
glm(default ~ balance, family = binomial, data = df)
GOOD — CORRECT APPROACH
# Use penalized regression
library(glmnet)
fit <- cv.glmnet(x_matrix, y, family = "binomial")

Still stuck?

Paste your code in RChat and the AI will fix this error in context.

Try RChat Free →

RELATED MODELING & REGRESSION ERRORS