# Lesson 12: ANOVA

Lesson 12: ANOVA

## Overview

Here we'll introduce ANOVA (analysis of variance) using lm(), including the use of multiple predictors (multiple-way ANOVA), the assessment of interactions and the assessment of the residuals.

## Objectives

Upon completion of this lesson, you should be able to:

• Fit ANOVA models using lm() and interpret the output using summary(), anova(), and TukeyHSD()
• Assess model validity using diagnostic plots
• Specify multiple predictors and their interactions
• Calculate predicted values (group means) for complex models
• Visualize interactions using interaction.plot()

## R

The R code file and data files for this lesson can be found on the Essential R - Notes on learning R page.

# 12.1 - Categorical Predictors: t.test() vs. oneway.test() vs. lm()

12.1 - Categorical Predictors: t.test() vs. oneway.test() vs. lm()

Here we'll compare the use of the t-sample t-test t.test() , the one.way test oneway.test() and our old friend lm() for fitting models with categorical predictors.

# 12.2 - Interpreting Output: summary(), anova(), aov(), and TukeyHSD()

12.2 - Interpreting Output: summary(), anova(), aov(), and TukeyHSD()

Here we'll introduce anova() and TukeyHSD() which help us understand our linear model in ways that complement the output from summary()

# 12.3 - Regression Assumptions in ANOVA

12.3 - Regression Assumptions in ANOVA

In this video we'll consider how we could deal with violations of regression assumptions in ANOVA.

# 12.4 - Models with Multiple Predictors: Specification and Interpretation

12.4 - Models with Multiple Predictors: Specification and Interpretation

In this video we'll consider how we can combine multiple predictors to increase the utility of our models, and we'll consider how to interpret the output when we have many parameters reported.

# 12.5 - Interactions Between Predictors: Reading Output and Calculating Group Means

12.5 - Interactions Between Predictors: Reading Output and Calculating Group Means

One of the challenges of using mutliple predictor variables is the reality that there can be interactions between them . In this video we'll consider how to specify models with interactions, how to test interactions for significance, and how to calculate group means when interactions are present (using our old friend predict()).

# 12.6 - Visualizing Interactions Between Predictors

12.6 - Visualizing Interactions Between Predictors

Interactions can be difficult to understand - a good plot can greatly simplify this as we'll see with the use of interaction.plot() in this video.

# 12.7 - TukeyHSD() and Interactions

12.7 - TukeyHSD() and Interactions

We've already introduced TukeyHSD() for testing all pairwise comparisons in our model. He're we'll demonstrate why control of the family-wise error provided by TukeyHSD() is so important - as we'll see adding an interaction greatly increases the number of pairwise comparisons.

# 12.8 - The HSD.test() Function

12.8 - The HSD.test() Function

We'll close out this chapter by introducing the function HSD.test() from the package "agricolae". This provides a couple of very useful features for working with ANOVA models.

NOTE! Chapter 12 of EssentialR demonstrates how to use HSD.test() for interactions.

 [1] Link ↥ Has Tooltip/Popover Toggleable Visibility