# 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.