[R-sig-ME] extracting p values for main effects of binomial glmm
henrik.singmann at psychologie.uni-freiburg.de
Thu Mar 5 12:25:23 CET 2015
As others have pointed out, the issue of obtaining p-values for effects is not trivial and there are pitfalls. Nevertheless I think that the easiest way to obtain what you want is to use mixed(..., method = "LRT") from package afex (full disclaimer: I am the main author of said package and function).
mixed() takes care of some issues, such as using appropriate coding and how to test main effects in the presence of interactions, in not uncontroversial but sensible ways (e.g., it does the latter by simply removing the main effect in a brute-force manner from the model-matrix and compare the full with the so reduced model). The way things are handled in mixed might not be correct in all cases but may provide exactly the combination of ease of use with sensible defaults that may be helpful in your case. In other words, it tries to adopt an approach often taken by commercial statistics packages.
You simply call mixed instead of glmer which fits and refits various versions of the model to provide likelihood-ratio tests for all effects as you want them. Note however, that mixed() cannot deal with the way you specify the model using cbind() as dependent variable. What you need to do is compute the proportions of "successes" and pass the number of observations as weights. Assuming your data resides in a data.frame df this would result in something along the following lines:
df$prop_weights <- df$Offspring + df$Eggs_Offspring
df$proportion_hatched <- df$Offspring/df$prop_weights
m1 <- mixed(proportion_hatched ~ Diet * Infection_status * Day + (1|SubjectID) + (1|Day), data = df, family=binomial, weights = df$proportion_weights, method = "LRT")
However, as Ken Beath has said, the main effects may not be sensible given interactions. To asses the degree of this threat for your data (which very much much depends on the type of interaction and their size) I suggest to follow the excellent advice of fortune(193) to "take the unusual step of plotting the data." This can be done nicely with e.g., the effects package, even for complicated interactions and binomial mixed models.
Hope this helps,
Am 04.03.2015 um 21:11 schrieb Megan Kutzer:
> I'm fairly new to mixed models and have done a lot of reading without much
> success. Unfortunately there is no one at my institution who is really
> familiar with them so I thought I would try this list.
> I'm running a binomial generalized linear mixed effects model and I need
> p-values for the main effects. I know this isn't entirely correct with this
> type of model but my supervisor wants the p-values!
> The model is:
> glmer (Proportion hatched ~ Diet * Infection status * Day + (1|SubjectID) +
> (1|Day), family=binomial)
> Proportion hatched = cbind(Offspring, Eggs-Offspring)
> Diet is a factor with 2 levels
> Infection status is a factor with 4 levels
> Day is a factor with 3 levels
> Using Subject ID number and Day as random effects is supposed to control
> for pseudoreplication in the model, although I am not entirely sure that
> this is specified in the correct way. I wanted to include experimental
> replicate here too but the model failed to converge.
> My question is: is there a way to get p-values for the main fixed effects
> of Diet, Infection and Day?
> If you need more specific model information or the model output I would be
> happy to provide it.
> [[alternative HTML version deleted]]
Dr. Henrik Singmann
Universität Zürich, Schweiz
More information about the R-sig-mixed-models