February 9

Statistics
Two variables — one categorical
February 9, 2009
Outline
1. Explanatory and response variables
2. the relationship between a categorical and a quantitative variable (R, side-by-side boxplots)
3. modeling language in R.
4. the relationship between two categorical variables (R, xtabs())
5. Lurking variables and Simpson’s paradox
Homework
1. Read Section 1.5, A.7.
2. Do problems 1.20,22. (Due Thursday, February 12)
Useful R
>
>
>
>
bwplot(count~spray,data=InsectSprays)
summary(count~spray,data=InsectSprays,fun=median)
# package Hmisc
xtabs(~Write+Fold,data=ud)
xtabs(Freq~Outcome+Treatment,data=kidney) # kidney is a new dataset
The insect spray data comes from this table in an article by Beall. The insect is commonly known as the tomato
hornworm and the five-spotted hawkmoth.