Table13 <- read.csv("https://sullystats.github.io/Stats7e/Data/Ch13/Table13.csv")
head(Table13)
## Age Drug HDL
## 1 18 to 39 Placebo 4
## 2 18 to 39 Placebo 3
## 3 18 to 39 Placebo -1
## 4 18 to 39 5 mg 9
## 5 18 to 39 5 mg 5
## 6 18 to 39 5 mg 6
Now,
run a two-way ANOVA treating HDL as the response variable and Age & Drug as
the treatments. Note that we include the interaction term Age:Drug in the
analysis.
summary(aov(HDL ~ Age + Drug + Age:Drug,data=Table13))
## Df Sum Sq Mean Sq F value Pr(>F)
## Age 1 14.22 14.22 3.507 0.0857 .
## Drug 2 208.33 104.17 25.685 4.61e-05 ***
## Age:Drug 2 8.78 4.39 1.082 0.3697
## Residuals 12 48.67 4.06
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The
P-value for the interaction term is 0.3697. The P-value for Age is 0.0857 and
the P-value for Drug is 4.61e-05 = 4.61 x \(10^{-5}\) =
0.0000461.