ufuk beyaztas
2012-Mar-20 23:22 UTC
[R] glm.fit: fitted probabilities numerically 0 or 1 occurred?
Hi all, I am doing bootstrap with logistic regression by using glm function, and I get the errors; glm.fit: fitted probabilities numerically 0 or 1 occurred and glm.fit: algorithm did not converge I have read some things about this issue in the mailing list. I can guess what was the problem. My data contains one or may be two outliers. Does the error occur due to these extreme values or something else such as MLE? Is there any way to to fix this problem? Regards, Ufuk ----- Best regards Ufuk -- View this message in context: http://r.789695.n4.nabble.com/glm-fit-fitted-probabilities-numerically-0-or-1-occurred-tp4490722p4490722.html Sent from the R help mailing list archive at Nabble.com.
S Ellison
2012-Mar-21 11:30 UTC
[R] glm.fit: fitted probabilities numerically 0 or 1 occurred?
> 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}}
ufuk beyaztas
2012-Mar-21 14:22 UTC
[R] glm.fit: fitted probabilities numerically 0 or 1 occurred?
Dear Ellison, Many thanks for your reply. The information you typed is clear and now I know what to do. Your suggestion about finding some coffee while running simulation is so good =) Regards ----- Best regards Ufuk -- View this message in context: http://r.789695.n4.nabble.com/glm-fit-fitted-probabilities-numerically-0-or-1-occurred-tp4490722p4492436.html Sent from the R help mailing list archive at Nabble.com.