# [R] glm.nb and anova

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Sat May 1 05:22:11 CEST 2004

```Hi,

I am trying to fit a negative binomial model with a number of parasite tapeworms as response variable to geographical coordinates
(actually preparing a trend surface before kriging). When I try an anova, I get warnings:

> glm4.nb<-glm.nb(wb~X4+Y4+I(X4^2)+I(Y4^2))
> anova(glm4.nb)
Analysis of Deviance Table

Response: wb

Terms added sequentially (first to last)

Df Deviance Resid. Df Resid. Dev P(>|Chi|)
NULL                       344      225.7
X4        1      0.0       343     9578.7       1.0
Y4        1   1695.7       342     7883.1       0.0
I(X4^2)   1   1992.2       341     5890.9       0.0
I(Y4^2)   1   5687.4       340      203.5       0.0
Warning messages:
1: tests made without re-estimating theta in: anova.negbin(glm4.nb)
2: Algorithm did not converge in: method(x = x[, varseq <= i, drop = FALSE], y = object\$y, weights = object\$prior.weights,
3: Algorithm did not converge in: method(x = x[, varseq <= i, drop = FALSE], y = object\$y, weights = object\$prior.weights,
4: Algorithm did not converge in: method(x = x[, varseq <= i, drop = FALSE], y = object\$y, weights = object\$prior.weights,
>

Results look like non sense with an intercept deviance smaller than the next variables... One can see that X4  has a null deviance.
If X4 is removed from the model, Y4 get a null deviance in the model updated (due to an intercept deviance smaller), and so on...
Actually smaller intercept deviance and null deviance for the first variable is obtained for every first independant variable,
except when only one is left in the model.

Can somebody tell me what happens?