Different p-values for anova() and summary() in glm.nb

using this code

library(MASS)
n = c(300, 200, 100)
group = rep(1:3, n)
x=c(rnbinom(300, size=2, mu=2.47), rnbinom(200, size=2, mu=2.27),
rnbinom(100, size=2, mu=2.27))
glm1 = glm.nb(x ~ factor(group))

I have created three neg. binomial distributions and analysed them using a glm. The independent variable (group) is meant to be categorial. When I use anova(glm1), I get an p-value (Pr (>Chi)) of 0.07. However, when I use summary(glm1), I get a p-value (Pr (>|z|) of 0.2 for factor 2 and 0.02 for factor 3. Thus, depending on if I use summary() or anova(), the factor is significant or it's not. I have three questions and would be very glad if someone could help me with one of these.

1. Can I conclude if group is a significant factor or not?
2. Residuals are not distributed normally. Can I use anova(glm1) nonetheless?
3. Apparently summary() gives me an intercept and two factors. Do the two factors relate to the difference between group 1 and 2 respectively between group 1 and 3?

I would really appreciate your help, even only a small hint on one of these question would be great. Please tell me, if any information is missing or if I didn't express myself comprehensibly.

• anova(glm1) tests the hypothesis whether the whole group variable is significant or not whereas summary(glm1) provides Wald-tests for the single group levels (compared to the reference group level). For example: The p-value for group level 2 after summary is for the test of the difference between group level 1 (the reference) and the group level 2. See also my answer here and this post. – COOLSerdash Aug 20 '13 at 19:29

The summary.glm() for glm is the Wald test for that level of factor (compared to the base level), while the anova.glm() is the Chisquared-test (based on deviance) for the whole factor variable. So the significance of Wald test may be misunderstood sometimes.

In this case, the summary.negbin is the same as summary.glm, providing the Wald test. On the other hand, the anova.negbin provides sequential likelihood ratio tests.

Regarding to your questions.

1. group factor is not significant, and it can be dropped.

2. anova.negbin() is based on likelihood ratio test.

3. Yes. (If regardless the link function,) the estimate values for your factor is the expected difference of the linear predictor, compared to the base level.

• Thank you very much for your kind and helpful answer! Just to clarify: With "2. anova.glm() is based on deviance" you mean, that negative binomial distribution is no problem for anova? As I understand, glm.nb already accounts for the neg. binom. distribution. Again, thanks for your answer. – Renoir Pulitz Aug 21 '13 at 16:31
• Sorry, in your case, it refers to the anova.negbin(), which is doing the likelihood ratio test. (I have changed the answer). So the function is suitable for your negtative binomial model, but the concept is a deviance test rather than a classic anova. (i.e you are not doing a classic anova now) – Vincent Aug 22 '13 at 9:04
• so does the p value reported from the summary function takes into account the contribution by other factors in the model then? – tatami Apr 18 '18 at 14:06