[R] glm.fit: fitted probabilities numerically 0 or 1 occurred?
S Ellison
S.Ellison at LGCGroup.com
Wed Mar 21 12:30:00 CET 2012
> I get the errors;
> glm.fit: fitted probabilities numerically 0 or 1 occurred and
> glm.fit: algorithm did not converge
> .....
> Is there any way to to
> fix this problem?
There are two separate issues.
One is the appearance of fitted values at 0 or 1.
The other is the lack of convergence.
The first is usually not fatal; it means that the probabilities are so close to 0 or 1 that a double precision value can't distinguish them from 0 or 1. Often that's a transient condition during iteration and the final fitted values are inside (0,1), but final fitted values can also be out there if you have continuous predictor values a long way out; by itself, that usually won't stop a glm.
The second is a bit more problematic. Sometimes it's just that you need to increase the maximum number of iterations (see the control= argument and ?glm.control). That is always worth a try - use some absurdly high number like 1000 instead of the default 25 and go find some coffee while it thinks about it. If that solves your problem then you're OK, or at least as OK as you can be with a data set that hard to fit.
But if you're bootstrapping with some anomalous values it is also possible that some of your bootstrapped sets have too high a proportion of anomalies, and under those conditions it's possible that there could be no sensible optimum within reach.
One way of dealing with that in a boostrap or other simulation context is to check the 'converged' value and if it's FALSE, return an NA for your statistic. But of course that is a form of censoring; if you have a high proportion of such instances you'd be on very thin ice drawing conclusions.
S Ellison
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list