glm.mp.con {multpois} | R Documentation |
Contrast tests for multinomial-Poisson GLM
Description
This function conducts post hoc pairwise comparisons on generalized linear models (GLMs) built
with glm.mp
. Such models have nominal response types, i.e., factor
s with
unordered categories.
Usage
glm.mp.con(
model,
formula,
adjust = c("holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"),
...
)
Arguments
model |
A multinomial-Poisson generalized linear model created by |
formula |
A formula object in the style of, e.g., |
adjust |
A string indicating the p-value adjustment to use. Defaults to |
... |
Additional arguments to be passed to |
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 glm.mp.con
should compare its results to
emmeans
results for models built with glm
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.
Value
Pairwise comparisons for all levels indicated by the factors in formula
.
Author(s)
Jacob O. Wobbrock
References
Baker, S.G. (1994). The multinomial-Poisson transformation. The Statistician 43 (4), pp. 495-504. doi:10.2307/2348134
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 doi:10.48550/arXiv.1707.08538
See Also
Anova.mp()
, glm.mp()
, glmer.mp()
, glmer.mp.con()
, stats::glm()
, stats::glm.control()
, emmeans::emmeans()
Examples
library(multpois)
library(car)
library(nnet)
library(emmeans)
## two between-subjects factors (X1,X2) with dichotomous response (Y)
data(bs2, package="multpois")
bs2$PId = factor(bs2$PId)
bs2$Y = factor(bs2$Y)
bs2$X1 = factor(bs2$X1)
bs2$X2 = factor(bs2$X2)
contrasts(bs2$X1) <- "contr.sum"
contrasts(bs2$X2) <- "contr.sum"
m1 = glm(Y ~ X1*X2, data=bs2, family=binomial)
Anova(m1, type=3)
emmeans(m1, pairwise ~ X1*X2, adjust="holm")
m2 = glm.mp(Y ~ X1*X2, data=bs2)
Anova.mp(m2, type=3)
glm.mp.con(m2, pairwise ~ X1*X2, adjust="holm") # compare
## two between-subjects factors (X1,X2) with polytomous response (Y)
data(bs3, package="multpois")
bs3$PId = factor(bs3$PId)
bs3$Y = factor(bs3$Y)
bs3$X1 = factor(bs3$X1)
bs3$X2 = factor(bs3$X2)
contrasts(bs3$X1) <- "contr.sum"
contrasts(bs3$X2) <- "contr.sum"
m3 = multinom(Y ~ X1*X2, data=bs3, trace=FALSE)
Anova(m3, type=3)
emmeans::test(
contrast(emmeans(m3, ~ X1*X2 | Y, mode="latent"), method="pairwise", ref=1),
joint=TRUE, by="contrast"
)
m4 = glm.mp(Y ~ X1*X2, data=bs3)
Anova.mp(m4, type=3)
glm.mp.con(m4, pairwise ~ X1*X2, adjust="holm") # compare