Description Usage Format Details Source Examples
The Alligator data, from Agresti (2002), comes from a study of the primary food choices of alligators in four Florida lakes. Researchers classified the stomach contents of 219 captured alligators into five categories: Fish (the most common primary food choice), Invertebrate (snails, insects, crayfish, etc.), Reptile (turtles, alligators), Bird, and Other (amphibians, plants, household pets, stones, and other debris).
1 |
A frequency data frame with 80 observations on the following 5 variables.
lakea factor with levels George Hancock Oklawaha Trafford
sexa factor with levels female male
sizealligator size, a factor with levels large (>2.3m) small (<=2.3m)
foodprimary food choice, a factor with levels bird fish invert other reptile
countcell frequency, a numeric vector
The table contains a fair number of 0 counts.
food is the response variable. fish is the most frequent choice, and often
taken as a baseline category in multinomial response models.
Agresti, A. (2002). Categorical Data Analysis, New York: Wiley, 2nd Ed., Table 7.1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | data(Alligator)
# change from frequency data.frame to table
allitable <- xtabs(count~lake+sex+size+food, data=Alligator)
# Agresti's Table 7.1
structable(food~lake+sex+size, allitable)
plot(allitable, shade=TRUE)
# mutual independence model
mosaic(~food+lake+size, allitable, shade=TRUE)
# food jointly independent of lake and size
mosaic(~food+lake+size, allitable, shade=TRUE, expected=~lake:size+food)
if (require(nnet)) {
# multinomial logit model
mod1 <- multinom(food ~ lake+size+sex, data=Alligator, weights=count)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.