multpois
R package for analyzing nominal responses using the multinomial-Poisson trick
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.5%) to scientific vocabulary
Repository
R package for analyzing nominal responses using the multinomial-Poisson trick
Basic Info
- Host: GitHub
- Owner: wobbrock
- License: gpl-3.0
- Language: HTML
- Default Branch: main
- Size: 333 KB
Statistics
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
multpois
Jacob O. Wobbrock, University of Washington wobbrock@uw.edu
The goal of multpois is to use the multinomial-Poisson trick to provide for the analysis of nominal response data with or without repeated measures. Such responses, which often arise from surveys or experiments, consist of unordered categories. Although dichotomous responses can be analyzed with glm() or lme4::glmer() using the family=binomial option, there is no analogous family=multinomial option for polytomous responses. In the case of purely between-subjects data, nnet::multinom() can be used, but it cannot take random factors and therefore cannot handle repeated measures. To address this issue, the multpois package provides for the equivalent of a family=multinomial option in glm() or lme4::glmer() via the multinomial-Poisson trick, which converts nominal response data into counts of categorical alternatives and analyzes these counts using (mixed) Poisson regression. Omnibus tests of main effects and interactions are provided through analysis of variance-style output. Post hoc pairwise comparisons are also provided through contrast testing.
Installation
You can install the multpois package like so:
r
install.packages("multpois")
Example
This is a basic example which shows you how to solve a common problem:
``` r library(multpois) set.seed(123) # for repeatable results
a generic 2x2 between-subjects example
ac = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.1, 0.6, 0.3)) ad = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.4, 0.4, 0.2)) bc = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.5, 0.1, 0.4)) bd = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.1, 0.5, 0.4)) df1 = data.frame( PId = factor(seq(1, 60, 1)), X1 = factor(c(rep("a",30), rep("b",30))), X2 = factor(rep(c(rep("c",15), rep("d",15)), times=2)), Y = factor(c(ac, ad, bc, bd), levels=c("yes","no","maybe")) ) View(df1) mosaicplot( ~ X1 + X2 + Y, data=df1, cex=1, col=c("lightgreen","pink","lightyellow")) m = glm.mp(Y ~ X1X2, data=df1) Anova.mp(m, type=3) glm.mp.con(m, pairwise ~ X1X2, adjust="holm")
a generic 2x2 within-subjects example
ac = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.2, 0.6, 0.2)) ad = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.4, 0.4, 0.2)) bc = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.5, 0.2, 0.3)) bd = sample(c("yes","no","maybe"), size=15, replace=TRUE, prob=c(0.2, 0.5, 0.3)) df2 = data.frame( PId = factor(rep(1:15, times=4)), X1 = factor(c(rep("a",30), rep("b",30))), X2 = factor(rep(c(rep("c",15), rep("d",15)), times=2)), Y = factor(c(ac, ad, bc, bd), levels=c("yes","no","maybe")) ) View(df2) mosaicplot( ~ X1 + X2 + Y, data=df2, cex=1, col=c("lightgreen","pink","lightyellow")) m = glmer.mp(Y ~ X1X2 + (1|PId), data=df2) Anova.mp(m, type=3) glmer.mp.con(m, pairwise ~ X1X2, adjust="holm") ```
Owner
- Name: Jacob O. Wobbrock
- Login: wobbrock
- Kind: user
- Location: Seattle, WA
- Company: University of Washington
- Website: http://faculty.washington.edu/wobbrock/
- Twitter: wobbrockjo
- Repositories: 1
- Profile: https://github.com/wobbrock
Professor at University of Washington
GitHub Events
Total
- Watch event: 1
- Push event: 49
Last Year
- Watch event: 1
- Push event: 49
Packages
- Total packages: 1
-
Total downloads:
- cran 186 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
cran.r-project.org: multpois
Analyze Nominal Response Data with the Multinomial-Poisson Trick
- Homepage: https://github.com/wobbrock/multpois/
- Documentation: http://cran.r-project.org/web/packages/multpois/multpois.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 0.3.3
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- R >= 2.10 depends
- car >= 3.1.2 imports
- dfidx >= 0.0.5 imports
- dplyr >= 1.1.4 imports
- lme4 >= 1.1.35.5 imports
- plyr >= 1.8.9 imports
- emmeans >= 1.10.3 suggests
- knitr >= 1.48 suggests
- lmerTest >= 3.1.3 suggests
- nnet >= 7.3.19 suggests
- rmarkdown * suggests
- spelling * suggests
- testthat >= 3.2.1.1 suggests