Skip to content
Prev 132337 / 398506 Next

Two repeated warnings when running gam(mgcv) to analyse my dataset?

The model here is just a penalised GLM, and the warnings relate to the GLM 
fitting process. Fitted probabilities of 0 or 1 can be perfectly appropriate, 
but do indicate that the linear predictor is not really uniquely defined, and 
that some care may be needed in interpreting results (for example, if the 
fitted probabilities are zero or one, then a CI for the corresponding linear 
predictor will depend more on the prior assumptions about smoothness than 
anything else). This problem is not really GAM specific, it relates to any 
`logistic regression' model. 

Similarly, the GLM fitting IRLS iterations are not guaranteed to converge, and 
can fail, especially for overly flexible logistic regression models. Try 
this, for example....

x <- 1:10
y <- c(0,0,0,0,0,1,1,1,1,1)
glm(y~x,family=binomial)

I get...
...
Warning messages:
1: In glm.fit(x = X, y = Y, weights = weights, start = start, etastart = 
etastart,  :
  algorithm did not converge
2: In glm.fit(x = X, y = Y, weights = weights, start = start, etastart = 
etastart,  :
  fitted probabilities numerically 0 or 1 occurred

...as models become more complex the scope for this sort of thing to happen 
increases, and some simplification may be appropriate. 

That said, mgcv::gam fitting with all smoothing parameters fixed, is slightly 
more likely to fail in this way than `glm' or `mgcv::gam' with some smoothing 
parameters  estimated, because of the steps taken to stabilise divergent fit 
iterations. When all smoothing parameters are fixed, mgcv uses older fitting 
routines that don't try as hard to stabilise a divergent fit as the newer 
fitting routines. This is a bit of an anomaly and I'll try and fix it for a 
future release. 

best,
Simon
On Monday 17 December 2007 11:53, zhijie zhang wrote: