glm.mp {multpois} | R Documentation |
Multinomial-Poisson GLM for nominal response data
Description
This function uses the multinomial-Poisson trick to analyze nominal response data using a Poisson generalized linear model (GLM). The nominal response should be a factor with two or more unordered categories. The independent variables should be between-subjects factors and/or numeric predictors.
Usage
glm.mp(formula, data, ...)
Arguments
formula |
A formula object in the style of, e.g., |
data |
A data frame in long-format. See the |
... |
Additional arguments to be passed to |
Details
This function should be used for nominal response data with only between-subjects factors or predictors.
In essence, it provides for the equivalent of glm
with family=multinomial
,
were that option to exist. (That option does not exist, but multinom
serves the same
purpose.)
For data with repeated measures, use glmer.mp
, which can take random factors and thus handle
correlated responses.
Users wishing to verify the correctness of glm.mp
should compare Anova.mp
results
to Anova
results for models built with glm
using
family=binomial
(for dichotomous responses) or multinom
(for polytomous
responses). The results should be similar if not identical.
Post hoc pairwise comparisons for factors can be conducted with glm.mp.con
.
Value
A Poisson regression model of type glm
. See the return value for
glm
.
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.con()
, glmer.mp()
, glmer.mp.con()
, stats::glm()
, stats::glm.control()
, nnet::multinom()
Examples
library(multpois)
library(car)
library(nnet)
## 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)
m2 = glm.mp(Y ~ X1*X2, data=bs2) # compare
Anova.mp(m2, type=3)
## 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)
m4 = glm.mp(Y ~ X1*X2, data=bs3) # compare
Anova.mp(m4, type=3)