glm.mp: Multinomial-Poisson GLM for nominal response data

View source: R/glm.mp.R

glm.mpR 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., Y ~ X1*X2, where X1 and X2 are factors or predictors. The response Y must be of type factor. See the formula entry for glm.

data

A data frame in long-format. See the data entry for glm.

...

Additional arguments to be passed to glm. Generally, these are unnecessary but are provided for advanced users. They must not pass formula, data, or family arguments. See glm for valid arguments.

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. \Sexpr[results=rd]{tools:::Rd_expr_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 \Sexpr[results=rd]{tools:::Rd_expr_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)


multpois documentation built on April 3, 2025, 9:37 p.m.