Short version
How can I partition the variance from the different levels in a nested mixed-effects logistic regression? Preferably using R, but even general principles would be helpful as a start. This paper looks helpful but I keep getting lost.
Long version
I'm helping a student who wants to test the effects of social systems (pack living, free-roaming, etc.) and host species on the infection rate (seroprevalence) of a certain disease. She has data from a number of studies, each giving her a host species, its social system, the number of individuals examined (N), and the fraction of individuals found to be infected. Her advisor suggested doing a nested ANOVA (with host species nested inside social system, since her real interest is in the effect of social systems) on the logit- or probit-transformed seroprevalence. In R-speak, this would look like the following:
model1 <- lm(Seroprevalence_transformed ~ SocialSystem + SocialSystem/HostSpecies)
anova(model1)
Her advisor prefers this approach because it allows the partitioning of variance among the different explanatory factors/levels.
However, there are a number of studies where seroprevalence was found to be 0 or 1. We would have to exclude these data points, since their logits/probits are undefined. Obviously this is not ideal, so I was hoping there could be a better way.
I had the idea to try mixed-effects logistic regression instead. First I converted her seroprevalence data into a vector describing whether each individual was infected or not. To fit the model, I would use the lme4
package:
model2 <- glmer(Infected ~ SocialSystem + (1|HostSpecies))
This works just fine, and we can use the lmerTest
package to examine the quality of the model. However, I have been unable to figure out how to achieve something similar to ANOVA's variance partitioning.
I found an article called"Variance partitioning in multilevel logistic models that exhibit overdispersion" that seems to get at this exact problem, but unfortunately the math is a bit over my head.
Any advice that you modern-day wizards could impart would be much appreciated. Thanks in advance.