I'm sorry if this is a duplicate question; I searched around for an answer for some time, but couldn't find anything.
I want to build a model in R, with the proportional number of individuals ('count'/'allCount') as a response variable. 'count' is the number of individuals within a specific group, and 'allCount' the number of individuals with all groups combined. Here is the data, which is a subset for this specific group (a foraging guild of birds, within a larger bird community):
"count","allCount","site","treatment","elevation","field.season"
3,20,"CM","fragmented",800,"2016"
4,19,"CM","fragmented",800,"2016"
0,12,"SM","continuous",800,"2016"
1,21,"CA","fragmented",1200,"2016"
3,11,"SA","continuous",1200,"2016"
3,29,"SA","continuous",1200,"2016"
0,16,"SB","continuous",300,"2016"
12,38,"CB","fragmented",300,"2016"
3,22,"SM","continuous",800,"2016"
2,19,"CM","fragmented",800,"2016"
0,22,"SA","continuous",1200,"2016"
3,28,"CA","fragmented",1200,"2016"
15,39,"CB","fragmented",300,"2016"
3,19,"SB","continuous",300,"2016"
15,38,"CA","fragmented",1200,"2017"
12,22,"CA","fragmented",1200,"2017"
3,10,"CM","fragmented",800,"2017"
1,10,"SM","continuous",800,"2017"
1,11,"SM","continuous",800,"2017"
1,17,"CM","fragmented",800,"2017"
5,17,"SA","continuous",1200,"2017"
4,10,"SA","continuous",1200,"2017"
1,21,"SB","continuous",300,"2017"
1,9,"SB","continuous",300,"2017"
1,14,"CB","fragmented",300,"2017"
2,19,"CB","fragmented",300,"2017"
0,6,"CA","fragmented",1200,"2017"
4,14,"SA","continuous",1200,"2017"
2,12,"CM","fragmented",800,"2017"
1,12,"SM","continuous",800,"2017"
2,11,"SB","continuous",300,"2017"
I have tried three different ways of fitting the data.
1. Binomial with lme4
I started with a binomial
family in the package lme4
:
model1 <- glmer(count/allCount~ (1|site) + treatment + elevation + field.season +
treatment*elevation + treatment*field.season, family = "binomial", data=dat)
Curiously, this first model failed:
Error in pwrssUpdate(pp, resp, tol = tolPwrss, GQmat = GQmat, compDev = compDev, :
Downdated VtV is not positive definite
2. Binomial with glmmadmb
I then tried fitting the same model in the package glmmadmb
, this time without the error message:
model2 <- glmmadmb(count/allCount~ (1|site) + treatment + elevation + field.season +
treatment*elevation + treatment*field.season, family = "binomial", data=dat)
After checking overdispersion, it seemed like something was wrong with this model, too:
> overdisp.glmer(model2)
Residual deviance: 1848789055.502 on 24 degrees of freedom (ratio: 77032877.313)
3. Negative binomial
Finally, I tried fitting the model with a negative binomial distribution. This time, it converged without problems, and the residuals seemed well dispersed:
model3 <- glmmadmb(count/allCount*100~ (1|site) + treatment + elevation + field.season +
treatment*elevation + treatment*field.season, family = "nbinom", data=dat)
> overdisp.glmer(model3)
Residual deviance: 21.87 on 24 degrees of freedom (ratio: 0.911)
My Question:
- Is there something conceptually wrong with choosing the negative binomial distribution in this case?
- Why did my first model fail in the first place / why did the binomial model look so bad?