multpois

R package for analyzing nominal responses using the multinomial-Poisson trick

https://github.com/wobbrock/multpois

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
Last synced: 9 months ago · JSON representation

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
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

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

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

  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 186 Last month
Rankings
Dependent packages count: 28.0%
Dependent repos count: 34.5%
Average: 49.8%
Downloads: 86.7%
Maintainers (1)
Last synced: 10 months ago

Dependencies

DESCRIPTION cran
  • 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