## 18.7 Chapter 14: ANOVA

1. Is there a significant relationship between a pirate’s favorite pixar movie and the number of tattoos (s)he has? Conduct an appropriate ANOVA with fav.pixar as the independent variable, and tattoos as the dependent variable. If there is a significant relationship, conduct a post-hoc test to determine which levels of the independent variable(s) differ.
pixar.aov <- aov(formula = tattoos ~ fav.pixar,
data = pirates)

summary(pixar.aov)
##              Df Sum Sq Mean Sq F value Pr(>F)
## fav.pixar    14    226    16.1    1.43   0.13
## Residuals   985  11105    11.3

Answer: No, there is no significant effect

1. Is there a significant relationship between a pirate’s favorite pirate and how many tattoos (s)he has? Conduct an appropriate ANOVA with favorite.pirate as the independent variable, and tattoos as the dependent variable. If there is a significant relationship, conduct a post-hoc test to determine which levels of the independent variable(s) differ.
favpirate.aov <- aov(formula = tattoos ~ favorite.pirate,
data = pirates)

summary(favpirate.aov)
##                  Df Sum Sq Mean Sq F value Pr(>F)
## favorite.pirate   5     83    16.6    1.47    0.2
## Residuals       994  11248    11.3

Answer: No, there is no significant effect

1. Now, repeat your analysis from the previous two questions, but include both independent variables fav.pixar and favorite.pirate in the ANOVA. Do your conclusions differ when you include both variables?
pirpix.aov <- aov(formula = tattoos ~ favorite.pirate + fav.pixar,
data = pirates)

summary(pirpix.aov)
##                  Df Sum Sq Mean Sq F value Pr(>F)
## favorite.pirate   5     83    16.6    1.48   0.19
## fav.pixar        14    218    15.6    1.39   0.15
## Residuals       980  11029    11.2
1. Finally, test if there is an interaction between fav.pixar and favorite.pirate on number of tattoos.
pirpix.int.aov <- aov(formula = tattoos ~ favorite.pirate * fav.pixar,
data = pirates)

summary(pirpix.int.aov)
##                            Df Sum Sq Mean Sq F value Pr(>F)
## favorite.pirate             5     83    16.6    1.47   0.20
## fav.pixar                  14    218    15.6    1.38   0.16
## favorite.pirate:fav.pixar  65    685    10.5    0.93   0.63
## Residuals                 915  10344    11.3