Learn R Programming

multpois (version 0.3.3)

glmer.mp.con: Contrast tests for multinomial-Poisson GLMM

Description

This function conducts post hoc pairwise comparisons on generalized linear mixed models (GLMMs) built with glmer.mp. Such models have nominal response types, i.e., factors with unordered categories.

Usage

glmer.mp.con(
  model,
  formula,
  adjust = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"),
  ...
)

Value

Pairwise comparisons for all levels indicated by the factors in formula.

Arguments

model

A multinomial-Poisson generalized linear mixed model created by glmer.mp.

formula

A formula object in the style of, e.g., pairwise ~ X1*X2, where X1 and X2 are factors in model. The pairwise keyword must be used on the left-hand side of the formula. See the specs entry for emmeans.

adjust

A string indicating the p-value adjustment to use. Defaults to "holm". See the details for p.adjust.

...

Additional arguments to be passed to glmer. Most often, these additional arguments are used to specify alternate optimizers. (See Note, below.) These additional arguments must not pass formula, data, or family arguments. See glmer for valid arguments.

Author

Jacob O. Wobbrock

Details

Post hoc pairwise comparisons should be conducted only after a statistically significant omnibus test using Anova.mp. Comparisons are conducted in the style of emmeans but not using this function; rather, the multinomial-Poisson trick is used on the subset of the data relevant to each pairwise comparison.

Users wishing to verify the correctness of glmer.mp.con should compare its results to emmeans results for models built with glmer using family=binomial for dichotomous responses. Factor contrasts should be set to sum-to-zero contrasts (i.e., "contr.sum"). The results should be similar.

References

Baker, S.G. (1994). The multinomial-Poisson transformation. The Statistician 43 (4), pp. 495-504. tools:::Rd_expr_doi("10.2307/2348134")

Chen, Z. and Kuo, L. (2001). A note on the estimation of the multinomial logit model with random effects. The American Statistician 55 (2), pp. 89-95. https://www.jstor.org/stable/2685993

Guimaraes, P. (2004). Understanding the multinomial-Poisson transformation. The Stata Journal 4 (3), pp. 265-273. https://www.stata-journal.com/article.html?article=st0069

Lee, J.Y.L., Green, P.J.,and Ryan, L.M. (2017). On the “Poisson trick” and its extensions for fitting multinomial regression models. arXiv preprint available at tools:::Rd_expr_doi("10.48550/arXiv.1707.08538")

See Also

Anova.mp(), glmer.mp(), glm.mp(), glm.mp.con(), lme4::glmer(), lme4::glmerControl(), emmeans::emmeans()

Examples

Run this code
library(multpois)
library(car)
library(lme4)
library(lmerTest)
library(emmeans)

## two within-subjects factors (x1,X2) with dichotomous response (Y)
data(ws2, package="multpois")

ws2$PId = factor(ws2$PId)
ws2$Y = factor(ws2$Y)
ws2$X1 = factor(ws2$X1)
ws2$X2 = factor(ws2$X2)
contrasts(ws2$X1) <- "contr.sum"
contrasts(ws2$X2) <- "contr.sum"

m1 = glmer(Y ~ X1*X2 + (1|PId), data=ws2, family=binomial)
Anova(m1, type=3)
emmeans(m1, pairwise ~ X1*X2, adjust="holm")

m2 = glmer.mp(Y ~ X1*X2 + (1|PId), data=ws2)
Anova.mp(m2, type=3)
glmer.mp.con(m2, pairwise ~ X1*X2, adjust="holm") # compare

# \donttest{
## two within-subjects factors (x1,X2) with polytomous response (Y)
data(ws3, package="multpois")

ws3$PId = factor(ws3$PId)
ws3$Y = factor(ws3$Y)
ws3$X1 = factor(ws3$X1)
ws3$X2 = factor(ws3$X2)
contrasts(ws3$X1) <- "contr.sum"
contrasts(ws3$X2) <- "contr.sum"

m3 = glmer.mp(Y ~ X1*X2 + (1|PId), data=ws3)
Anova.mp(m3, type=3)
glmer.mp.con(m3, pairwise ~ X1*X2, adjust="holm")
# }

Run the code above in your browser using DataLab