Modeling & Regression Errors
GLM did not converge
Matches: algorithm did not converge
WHAT THIS ERROR MEANS
The iterative algorithm used to fit the generalized linear model failed to find a stable solution within the maximum number of iterations. This often indicates perfect separation in logistic regression.
HOW TO FIX IT
1. Check for perfect separation in your data.
2. Increase max iterations: glm(..., control = list(maxit = 100)).
3. Scale your predictors or reduce model complexity.
4. Consider using penalized regression (glmnet).
CODE EXAMPLES
BAD — THIS CAUSES THE ERROR
glm(y ~ x, family = binomial, data = df)
GOOD — CORRECT APPROACH
glm(y ~ x, family = binomial, data = df,
control = list(maxit = 100))Still stuck?
Paste your code in RChat and the AI will fix this error in context.
RELATED MODELING & REGRESSION ERRORS
NA/NaN/Inf in model fit Your data contains NA, NaN, or Inf values that the modeling function cannot hand...
Singular or rank-deficient fit Your model has perfect multicollinearity — some predictors are exact linear comb...
Fitted probabilities 0 or 1 In logistic regression, some predicted probabilities are extremely close to 0 or...
Factor has new levels in predict Your prediction data contains factor levels that weren't present in the training...