| icecream | R Documentation |
This synthetic long-format data set represents a survey of 40 respondents about their favorite ice cream flavors. Twenty of the respondents were adults and 20 were children. They were asked four times over the course of a year, once in the middle of each season (fall, winter, spring, summer), for their favorite ice cream flavor in that season.
This data set has a polytomous response Pref and two factors,
Age and Season. The response Pref has the unordered categories
{vanilla, chocolate, strawberry}. Factor Age has levels
{adult, child}. Factor Season has levels {fall, winter, spring, summer}.
It also has a PId column for a participant identifier. Each participant identifier is repeated
four times, once for each season.
A data frame with 160 observations on the following 4 variables:
a participant identifier with levels "1" ... "40"
a between-subjects factor with levels "adult", "child"
a within-subjects factor with levels "fall", "winter", "spring", "summer"
a polytomous response with categories "vanilla", "chocolate", "strawberry"
See vignette("multpois", package="multpois") for a complete analysis of this data set.
library(multpois)
data(icecream, package="multpois")
icecream$PId = factor(icecream$PId)
icecream$Pref = factor(icecream$Pref, levels=c("vanilla","chocolate","strawberry"))
icecream$Age = factor(icecream$Age, levels=c("adult","child"))
icecream$Season = factor(icecream$Season, levels=c("fall","winter","spring","summer"))
contrasts(icecream$Age) <- "contr.sum"
contrasts(icecream$Season) <- "contr.sum"
m = glmer.mp(Pref ~ Age*Season + (1|PId), data=icecream)
Anova.mp(m, type=3)
glmer.mp.con(m, pairwise ~ Age*Season, adjust="holm")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.