I am fitting a glmer model in the lme4 R package. I'm looking for an anova table with p-value shown therein, but I cannot find any package that fits it. Is it possible to do it in R?

The model I am fitting is of the form:

          group=='Four times a year'),

If you're willing to settle for Wald tests this should work:

gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
                   data = cbpp, family = binomial)

However, note (from ?Anova) that:

The designations "type-II" and "type-III" are borrowed from SAS, but the definitions used here do not correspond precisely to those employed by SAS. Type-II tests are calculated according to the principle of marginality, testing each term after all others, except ignoring the term's higher-order relatives; so-called type-III tests violate marginality, testing each term in the model after all of the others. This definition of Type-II tests corresponds to the tests produced by SAS for analysis-of-variance models, where all of the predictors are factors, but not more generally (i.e., when there are quantitative predictors). Be very careful in formulating the model for type-III tests, or the hypotheses tested will not make sense.

I would check your results very carefully to make sure they make sense!

Alternatively, you can use afex::mixed to get analogous tables via likelihood ratio test or parametric bootstrap; the latter is the most accurate, but also the slowest by far.

See ?pvalues in the lme4 package for more general discussion of p-value computation in the context of GLMMs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.