Why Convergence Warnings Need Investigation
A call to R’s glm() can return coefficients and fitted values while also issuing a warning. The returned numbers are not automatically unusable, but neither should they be accepted without investigation. A warning may indicate that the fitting algorithm stopped before its convergence criterion was met, or that some fitted values are at numerical extremes. These are different signals and require different checks.
A generalized linear model (GLM) specifies a response distribution, a link function, and a linear predictor. For observation \(i\), the linear predictor is \(\eta_i = \mathbf{x}_i^\mathsf{T}\boldsymbol{\beta}\), and the fitted mean is \(\hat{\mu}_i = g^{-1}(\eta_i)\), where \(g\) is the link function. GLM fitting commonly uses iteratively reweighted least squares, an iterative procedure that updates coefficient estimates until a stopping rule is met. The earlier material on GLM fitting and fitted means establishes this setup.
What R’s Convergence Check Means
For a GLM fit using R’s standard glm.fit() machinery, the fitting process compares the deviance from successive iterations. In simplified terms, convergence is declared when the relative deviance change falls below the tolerance set by epsilon. The standard control settings use epsilon = 1e-8 and maxit = 25; both can be changed through glm.control(). The check is a numerical stopping rule, not a test of whether the model is appropriate for the question.
Here \(D^{(t)}\) is the deviance at iteration \(t\). The constant 0.1 stabilizes the denominator when deviance is near zero. The comparison asks whether the change is small relative to the current deviance scale. If the condition has not been met by the maximum number of iterations, R may report that the algorithm did not converge. Increasing the iteration limit can be a useful diagnostic when progress is steady, but it does not correct a misspecified model, problematic data, or an ill-conditioned design.
A separate binomial warning may say that fitted probabilities numerically equal 0 or 1 occurred. This indicates that at least some fitted probabilities are extremely close to those boundaries for computer arithmetic. It is a prompt to inspect the data, the fitted values, and coefficient estimates; it is not the same message as failure to meet the deviance stopping rule. A later tutorial treats complete separation in logistic GLMs in detail, so here the task is to recognize the warning as a reason for further diagnosis rather than to infer its cause from the message alone.
Worked Example: Does the Iteration Limit Explain the Warning?
A hypothetical Poisson GLM with a log link is fitted in R using the default iteration limit. At the final two iterations, the deviance changes from 120.000 to 119.999. The fit reaches 25 iterations and reports that the algorithm did not converge. Determine whether the final deviance change satisfies the standard tolerance, then interpret two fitted means for linear predictors of \(-2\) and \(2\). Use \(\epsilon=10^{-8}\).
Method. Compare the relative deviance change with the stopping tolerance, then apply the inverse log link to the stated linear predictors.
The absolute deviance change is \(|119.999-120.000|=0.001\). The denominator is \(0.1+|119.999|=120.099\). Therefore, the convergence quantity is \(0.001/120.099 \approx 0.00000833\), or \(8.33\times10^{-6}\). Since \(8.33\times10^{-6}>10^{-8}\), the stated final change does not satisfy the criterion. Reaching 25 iterations is consistent with an iteration-limit warning.
For the Poisson log-link model, \(\hat{\mu}=\exp(\eta)\). At \(\eta=-2\), the fitted mean is \(\exp(-2)\approx0.1353\). At \(\eta=2\), it is \(\exp(2)\approx7.3891\). These calculations are fitted expected counts on the response scale, not additional convergence tests.
Check. The ratio is greater than the tolerance, so this trace does not show that the algorithm met its stopping rule. The two fitted means are positive, as required by the log link. A common mistake is to treat the existence of finite fitted means as proof of convergence; finite values do not establish that the stopping criterion was met.
A Reproducible Diagnostic Sequence
A disciplined check helps separate a coding problem from numerical difficulty or a potentially unsuitable model. Preserve the original warning and model call before refitting so that changes can be evaluated rather than guessed.
Note the family, link, formula, number of iterations, and any customized control settings. Distinguish a failure to converge from a warning about extreme fitted probabilities or another numerical issue.
Check that the response is coded as intended, that its values are permitted by the selected family, and that the family and link match the target. Confirm that the formula includes the intended variables and that missing-data handling has not changed the analysis set unexpectedly.
Use fitted values and, where appropriate, linear predictors to find non-finite values, boundary probabilities, extreme means, or implausible predictions. Interpret extremes in the units and context of the response.
Look for unusually large coefficients, standard errors, or unstable estimates. Compare coefficient magnitudes with predictor units and check whether estimates change sharply under reasonable coding or scaling choices.
Review factor levels, sparse combinations, unusual predictor values, and the scale of continuous variables. Do not assume a warning has one particular cause based on its wording alone.
Correct verified coding or specification issues first. If the trace suggests slow progress, a larger iteration limit may test whether the algorithm reaches the criterion. Recheck the warning and fitted quantities; do not treat disappearance of a warning by itself as validation.
In R, useful checks include fit$converged, fit$iter, fitted(fit), predict(fit, type = "link"), coef(fit), and summary(fit). These inspect different aspects of the fit: the convergence flag, iteration count, response-scale fitted values, linear predictors, estimates, and reported uncertainty. A convergence flag is informative, but it does not certify that the data coding, model assumptions, or predictions are sensible.
Worked Example: Interpreting Extreme Logistic Fitted Probabilities
A hypothetical binomial GLM with a logit link predicts whether a policyholder renews. The fitted model has an intercept of \(-3.0\) and a coefficient of \(18.4\) for a binary indicator \(z\), coded 0 or 1. The reported standard error for the coefficient is 620.0, and R warns that fitted probabilities numerically equal 0 or 1 occurred. Calculate the fitted probabilities at \(z=0\) and \(z=1\), and state what should be checked before accepting the fit.
Method. Calculate \(\eta=-3.0+18.4z\), then convert from log odds to probability using \(p=1/(1+\exp(-\eta))\).
For \(z=0\), \(\eta=-3.0+18.4(0)=-3.0\), so \(p=1/(1+\exp(3))\approx0.0474\). For \(z=1\), \(\eta=-3.0+18.4(1)=15.4\), so \(p=1/(1+\exp(-15.4))\approx0.9999998\). The second probability is extremely close to 1, consistent with a numerical boundary warning.
The coefficient is large relative to the intercept, and its standard error is also very large. Together with the extreme fitted probability, these are signals to inspect the response coding, the number of observations in each outcome-by-indicator combination, and the fitted values for individual records. The calculations alone do not establish why the warning arose, so the fit should not be accepted merely because a coefficient table was returned.
Check. Both probabilities follow from the stated logit model, with the second close to 1. A common mistake is to read a very large coefficient as a stable, precisely estimated effect. Here, the standard error of 620.0 makes that interpretation especially unjustified. The appropriate next step is diagnosis; increasing the iteration limit alone would not explain the extreme fitted value.
Scaling and Numerical Stability
Continuous predictors can be measured on very different scales. A coefficient is always tied to the units used: a coefficient per dollar is not numerically comparable to one per thousand dollars. Large or poorly balanced predictor scales can also make numerical computation less well-conditioned. Centering or rescaling may improve numerical behavior and make coefficients easier to inspect, but it cannot repair incorrect response coding or add information absent from the data.
For a log-link model, a linear change of predictor units can be written exactly in the linear predictor. Suppose \(z=(x-c)/s\), where \(c\) is a chosen center and \(s\ne0\) is a scale. If \(\eta=\beta_0+\beta_1x\), substitution gives \(\eta=(\beta_0+\beta_1c)+(\beta_1s)z\). Thus the fitted linear predictors are unchanged when the coefficients are transformed consistently. This explains why rescaling is a change of representation, not a different fitted relationship, in this simple linear-predictor case.
Worked Example: Re-expressing a Large-Unit Predictor
A hypothetical Poisson GLM with a log link uses an annual exposure predictor \(x\), recorded in individual units, and has linear predictor \(\eta=-6+0.004x\). Evaluate fitted means at \(x=1000, 2000,\) and \(3000\). Then define \(z=(x-2000)/1000\) and express the same linear predictor using \(z\).
Method. First calculate each linear predictor and exponentiate it. Then substitute \(x=2000+1000z\) into the original expression.
At \(x=1000\), \(\eta=-6+0.004(1000)=-2\), so \(\hat{\mu}=\exp(-2)\approx0.1353\). At \(x=2000\), \(\eta=-6+0.004(2000)=2\), so \(\hat{\mu}=\exp(2)\approx7.3891\). At \(x=3000\), \(\eta=-6+0.004(3000)=6\), so \(\hat{\mu}=\exp(6)\approx403.4288\).
Since \(x=2000+1000z\), substitution gives \(\eta=-6+0.004(2000+1000z)=2+4z\). The corresponding \(z\) values are \(-1,0,1\), which give linear predictors \(-2,2,6\) and therefore the same three fitted means. The fitted means are rounded to four decimal places.
Check. The centered-and-scaled expression reproduces the original linear predictors exactly. A common mistake is to change predictor units but keep the old coefficient unchanged. Here the coefficient becomes 4 per unit of \(z\), not 0.004; using 0.004 with \(z\) would define a different model.
Common Traps and Acceptance Criteria
The purpose of diagnosis is not to eliminate every warning at any cost. It is to determine whether the fit has a defensible specification and produces interpretable, stable estimates for the intended use. A GLM can converge and still be poorly specified; a fit that has not converged may nevertheless offer clues about which part of the setup needs attention.
- Blindly increasing maxit. More iterations are reasonable to test when the algorithm is still making progress. They are not a substitute for checking response coding, model specification, or extreme estimates.
- Ignoring the fitted values. A coefficient table can obscure predictions that are non-finite, at a binomial boundary, or implausibly large for the context. Inspect response-scale fitted values and their associated records.
- Treating different warnings as interchangeable. Failure to meet the iteration stopping rule and a warning about numerically extreme probabilities are different pieces of evidence. Record and investigate each message.
- Comparing coefficients without checking units. Rescaling a predictor changes the numerical coefficient. Compare effects on a meaningful scale and verify that transformations preserve the intended predictor.
- Accepting a fit because the warning disappears. A refit is useful only if the reason for the change is understood and the resulting fitted values and estimates remain credible.
Check Your Understanding
For each problem, identify the diagnostic implication as well as the requested calculation.
- A Poisson GLM has deviance 50.200 at one iteration and 50.199 at the next. Using the standard R convergence comparison and \(\epsilon=10^{-8}\), calculate the relative change and decide whether this pair meets the stopping rule. (Answer: \(0.001/50.299\approx1.99\times10^{-5}\), so it does not meet the \(10^{-8}\) stopping rule.)
- A logistic GLM has linear predictor \(\eta=\log(4)\) for a record. Calculate its fitted probability and state whether that value alone demonstrates convergence. (Answer: \(4/(1+4)=0.8000\); no, one fitted probability does not establish that the algorithm converged.)
- A log-link GLM has \(\eta=-1.5\) for a record. Calculate its fitted mean and state one additional quantity to inspect if the fit produced a convergence warning. (Answer: \(\exp(-1.5)\approx0.2231\); inspect, for example, the convergence flag, coefficient estimates, or other fitted values.)
- A model uses \(x\) with linear predictor \(\eta=1+0.02x\). Let \(z=(x-50)/10\). Express the same predictor in terms of \(z\), and state what happens to fitted values if the coefficients are transformed correctly. (Answer: \(x=50+10z\), so \(\eta=2+0.2z\); fitted linear predictors and fitted values are unchanged.)
- A binomial fit reports both an iteration warning and numerically extreme fitted probabilities. Name two checks that should precede a decision to increase the iteration limit. (Answer: verify response coding and inspect extreme fitted probabilities or their records; also review coefficient magnitudes and standard errors, factor-level outcome counts, or the family-link specification.)