Nested and Multi-factorial Anlysis of Variance

Uses

How this is done

Nested Design:

Multi-way design:

Challenges:

  1. Consider two analyses, one with model terms {Size, Depth[Size]} the other with model term {Pond#}. Phrase your prediction as to the size of the two SSModel and the two SSError terms. Test that prediction and understand why you get that result.
  2. Consider two analyses, one with full factorial model terms {Size, Depth, Size*Depth} the other with model terms {Size, Depth[Size]}. Phrase your prediction as to the size of the two SSModel and the two SSError terms. Test that prediction and understand why you get that result.
  3. Consider two analyses, one with full factorial model terms {Size, Depth, Size*Depth} the other with partial factorial model terms {Size, Depth}. Phrase your prediction as to the size of the two SSModel and the two SSError terms. Test that prediction and understand why you get that result.

To perform a two-way complete model ANOVA in R you would first import datafile "Trout3.txt", then you need to make sure that pond size and pond depth are treated as a categorical variables

> Trout3.txt <- read.table("/Trout3.txt", header=TRUE, sep="", na.strings="NA", dec=".", strip.white=TRUE)
> Trout3.txt$PondSize_cat <- as.factor(Trout3.txt$PondSize)

> Trout3.txt$PondDepth_cat <- as.factor(Trout3.txt$PondDepth)
> Trout3.txt$PDepth_PSize_cat <- as.factor(Trout3.txt$PDepth_PSize)
> AnovaModel.1 <- (lm(stLength ~ PondDepth_cat*PondSize_cat, data=Trout3.txt))
> anova(AnovaModel.1)

This is equivalent to piecing the terms together from a series of one-way ANOVAs. First create the model for the consistent size effects using a one-way ANOVA on PondSize, then report the results

> AnovaModel.2 <- (lm(stLength ~ PondSize_cat, data=Trout3.txt))
> anova(AnovaModel.2)

then you create the model for the consistent depth effects using a one-way ANOVA on PondDepth, then report the results

> AnovaModel.3 <- (lm(stLength ~ PondDepth_cat, data=Trout3.txt))
> anova(AnovaModel.3)

then you create the model for the one-way ANOVA on the specific combination of PondDepth and PondSize, then report the results

> AnovaModel.4 <- (lm(stLength ~ PDepth_PSize_cat, data=Trout3.txt))
> anova(AnovaModel.4)

the SS and df for Model.4 minus those for Model.2 and Model.3 are associated with the interaction between depth and size


last modified: 2/18/13