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.
- Can I conclude if group is a significant factor or not?
- Residuals are not distributed normally. Can I use
anova(glm1)
nonetheless? - 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.