One way analysis of variance helps us understand the relationship between one continuous dependent variable and one categorical independent variable. When we have one continuous dependent variable and more than one independent categorical variable we cannot use one way ANOVA. When we have two independent categorical variable we need to use two way ANOVA. When we have more than two categorical independent variables we need to use N way ANOVA.
In two way ANOVA there are three hypotheses of interest as listed below
- H0: There is an effect of the first factor on the dependent continuous variable (main effect)
- H0: There is an effect of the second factor variable on the dependent continuous variable (main effect)
- H0: There is a combined effect of the first and second factor variable on the continuous dependent variable (interaction)
The above hypotheses can be extended from two factor variables to N factor variables.
For results of two way ANOVA to be valid there are several assumptions that need to be satisfied. They are listed below.
- Observations must be independent within and across groups
- Observations are approximately normally distributed.
- There is equal variance in the observations
- We should not have any outliers especially when our design is unbalanced
- The errors are independent
When the normality and equal variance assumptions are violated you need to transform your data.
The dependent variable is the number of moths in a trap. The independent variables are location and type of lure. There were four locations (top, middle, lower and ground). There were three types of lure (scent, sugar and chemical).
Solutions to these exercises are found here
Read in the data and inspect its structure
Create summary statistics for location
Create summary statistics for type of lure
Create boxplots for each category
Check for normality
Check for equality of variance
Take a log transformation of our data
Perform a power analysis
Check homogeneity of variance