Two-Way ANOVA
Foundations of Two-Way Analysis of Variance
Definition of Two-Way ANOVA: Two-way analysis of variance is an extension of one-way ANOVA utilized when experimental observations or treatments are classified simultaneously according to two distinct criteria or factors.
Two Primary Structural Approaches: Two-way ANOVA encompasses two primary experimental designs that serve fundamentally different investigative purposes:
Randomized Block Design: Used when the investigator wants to isolate and remove an extraneous source of variation that is not of primary scientific interest, preventing that variation from inflating experimental error.
Factorial Design: Used when the investigator is actively interested in the effects of both factors (main effects) as well as the joint synergistic or antagonistic effect between them (interaction effect).
Concept of Interaction:
An interaction exists when the effect of one independent variable on the dependent variable changes depending on the level of the second independent variable.
Graphical Representation (Interaction Plots): If the line plots connecting condition means across levels are parallel, no interaction is present. If the lines diverge, converge, or cross, an interaction effect is present.

Randomized Block Design: Principles and Objectives
Core Objective of Blocking: Group experimental units into homogeneous subsets called "blocks" to partition out (remove) a known, extraneous source of variation from the within-group error term ().
Impact on Statistical Power:
Uncontrolled nuisance variation naturally winds up in the mean square error ().
A large diminishes the calculated -statistic ().
By removing block-to-block variation from the denominator error term, decreases, thereby increasing test power—the probability of correctly rejecting a false null hypothesis.
Fundamental Assumption: The treatment effect and the blocking effect must not interact with each other. It is assumed that all blocks respond similarly to the treatments.
Non-Random Nature of Blocks: Assignment of experimental units to blocks is not random; units are segregated based on pre-existing physical, biological, or demographic characteristics. However, within each block, assignment of subjects to experimental treatments is strictly randomized.
Prototypical Experimental Applications:
Academic Year Student Cohort:
Sample size: students ( juniors and seniors).
Response variable: Score on the final exam.
Treatment factor: Practice exam administration (practice exam vs. no practice exam).
Blocking factor: Academic year (junior vs. senior). The investigator has no primary interest in academic year, but blocks by it to eliminate baseline cohort variance from error.

Clinical Fever Reduction Trial:
Sample size: human subjects ( men and women).
Blocking factor: Sex (assignment to blocks is non-random: men, women).
Within-block randomization: Each sex block is randomly divided into Group 1 ( subjects receiving Treatment 1: Drug X ) and Group 2 ( subjects receiving Treatment 2: Placebo).
Response variable: Drop in body temperature.

Agricultural Field Plots:
Land areas are split into physical geographical blocks to control for spatial environmental gradients such as soil moisture, nutrient quality, and sunlight.

Canine Dietary Trial:
Sample size: dogs.
Blocking factor: Breed (Block A: poodles; Block B: German shepherds).
Within-block randomization: Poodles are randomly divided into Group 1 ( dogs, Treatment 1: new food for weeks) and Group 2 ( dogs, Treatment 2: "safe" food for weeks). German shepherds are randomly divided into Group 3 ( dogs, Treatment 1) and Group 4 ( dogs, Treatment 2).
Response variable: Comparison of dog health indices.

Statistical Structure of the Randomized Block ANOVA
Experimental Configuration:
Treatments are conventionally arranged as columns ("column variable"), and blocks are arranged as rows ("row variable").
Each treatment contains one, and only one, member from each block.
Total number of observations: , where is the number of treatments and is the number of blocks.
Formal Hypotheses:
Treatment Effect (Primary Focus):
Null hypothesis:
Alternative hypothesis:
Block Effect (Secondary Evaluation):
Null hypothesis:
Alternative hypothesis:
Degrees of Freedom Decomposition:
Treatment degrees of freedom:
Block degrees of freedom:
Error degrees of freedom:
Total degrees of freedom:
Standard Randomized Block ANOVA Table:
Source | Degrees of Freedom () | Sum of Squares () | Mean Square () | -Statistic |
|---|---|---|---|---|
Treatment | ||||
Block | ||||
Error | — | |||
Total | — | — |
Hypothesis Testing Decision Rule: Reject if the calculated -statistic is greater than the critical value , or if the associated -value is less than the predetermined significance threshold .
Case Study: Deer Mice Diet Randomized Block Analysis
Study Description: An experiment evaluates weight gain over one month across three diets in ten litters of white-footed deer mice of approximately equal age.
Treatments (): Diets A, B, and C.
Blocks (): Litters through .
Total sample size: mice.
Rationale: Genetic and maternal differences across litters create variance that would obscure differences between diets if pooled into experimental error.
Complete Raw Experimental Data (Weight Gain in g):
Litter 1: Group A = , Group B = , Group C =
Litter 2: Group A = , Group B = , Group C =
Litter 3: Group A = , Group B = , Group C =
Litter 4: Group A = , Group B = , Group C =
Litter 5: Group A = , Group B = , Group C =
Litter 6: Group A = , Group B = , Group C =
Litter 7: Group A = , Group B = , Group C =
Litter 8: Group A = , Group B = , Group C =
Litter 9: Group A = , Group B = , Group C =
Litter 10: Group A = , Group B = , Group C =
ANOVA Output:
Source | DF | SS | MS | F | P |
|---|---|---|---|---|---|
Group | |||||
Litter | |||||
Error | |||||
Total |
Summary Statistics:
Standard error of regression:
Coefficient of determination:
Adjusted :
Group Means (Individual Confidence Intervals based on pooled standard deviation):
Group A: Mean =
Group B: Mean =
Group C: Mean =
Litter Means:
Litter 1: Mean =
Litter 2: Mean =
Litter 3: Mean =
Litter 4: Mean =
Litter 5: Mean =
Litter 6: Mean =
Litter 7: Mean =
Litter 8: Mean =
Litter 9: Mean =
Litter 10: Mean =

Statistical Interpretation:
The primary treatment of diet group is statistically significant (, ), indicating significant differences in weight gain among the three diets.
The block effect of litter is also highly significant (, ), confirming that litters introduced substantial variation (). Removing this variance prevented from inflating, enabling clear detection of the diet effect.
Repeated Measures ANOVA: Special Case of Randomized Block Design
Conceptual Mechanism:
Repeated measures ANOVA is an extension of the paired -test to scenarios where more than two serial measurements are obtained from the exact same experimental unit.
The experimental object acts as its own block, partitioning out between-subject variability from the within-subject changes over time or condition.
Cichlid Brooding Study Context:
Subjects (): Eight individual male convict cichlids.
Serial intervals (): Brooding behavior tracked over consecutive days.
Response variable: Brooding activity time (in seconds/minutes).
Design: The primary question is whether brooding activity changes over time, while controlling for individual behavioral baselines across males.
Complete Raw Experimental Data (Brooding Time):
Male 1: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 2: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 3: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 4: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 5: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 6: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 7: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Male 8: Day 1 = , Day 2 = , Day 3 = , Day 4 = , Day 5 =
Two-Way ANOVA Table:
Source | DF | SS | MS | F | P |
|---|---|---|---|---|---|
Day | |||||
Male | |||||
Error | |||||
Total |
Model Summary:
Standard deviation:

Statistical Interpretation:
The Day treatment effect is highly significant (, ), proving that brooding activity varies significantly across days (rising substantially from early days toward Day 4 and Day 5).
The Male block effect is highly significant (, ), validating that individual males have significantly different baseline brooding durations.
Factorial Design: Principles, Hypotheses, and ANOVA Architecture
Core Concepts:
Factorial designs evaluate two or more independent factors simultaneously, crossing every level of one factor with every level of the other.
Unlike randomized block designs, factorial designs explicitly permit, detect, and test for interaction effects between factors.
Both factors represent primary research interests (main effects).

Partition of Total Variation: Total sum of squares is partitioned into four independent components:
Variation due to Factor 1 ().
Variation due to Factor 2 ().
Variation due to the Interaction ().
Unexplained residual error ().
Hypotheses in a Two-Factor Factorial Design:
Main Effect 1:
Main Effect 2:
Interaction Effect:
Factorial ANOVA Table Framework:
Source | Degrees of Freedom () | Sum of Squares () | Mean Square () | -Statistic |
|---|---|---|---|---|
Treatment 1 | ||||
Treatment 2 | ||||
Interaction | ||||
Error | Difference: | — | ||
Total | — | — |
Case Study: Mouse Diet and Stress Experiment (2x2 Factorial Design)
Study Description: Laboratory mice are tested to evaluate the effect of Diet (Junk food vs. Control), Stress level (Low vs. High), and their potential interaction on weight gain (measured as increased in one week).
Design: factorial layout with mice per treatment combination ( total mice).
Factor A (Diet): Fixed, levels (Junk food, Control).
Factor B (Stress): Fixed, levels (Low, High).
Response variable: Weight gain ().
Complete Raw Experimental Data (Weight Gain in mg):
Junk food / Low stress: (Mean = \,mg)
Junk food / High stress: (Mean = \,mg)
Control / Low stress: (Mean = \,mg)
Control / High stress: (Mean = \,mg)
Tested Hypotheses:
Main effect of diet: vs.
Main effect of stress: vs.
Interaction effect: vs.
Software Execution: Conducted using the General Linear Model (GLM) in Minitab with factor coding , specifying interactions to the 2nd order (
Diet*Stress).ANOVA Output:
Source | DF | Adj SS | Adj MS | F-Value | P-Value |
|---|---|---|---|---|---|
Diet | |||||
Stress | |||||
Diet*Stress | |||||
Error | |||||
Total |
Model Summary:
Interpretation of Results at :
Diet Effect (): Reject . Weight gain is significantly higher on the junk food diet compared to the control diet.
Stress Effect (): Reject . Weight gain is significantly higher under high stress conditions than under low stress conditions.
Interaction Effect (): Reject . A statistically significant interaction exists between diet and stress.
Interaction Plot Behavior: The lines for high and low stress across diets are non-parallel. Weight gain increases with junk food across both stress levels, but the magnitude of increase is substantially greater under high stress ( increase) than under low stress ( increase).
Case Study: Road Warbler Culmen Length (3x2 Factorial Design)
Study Description: An evolutionary biologist sampled museum specimens of road warblers to evaluate culmen (bill) length across regions and sexes.
Factor 1 (Location): Fixed, levels (Eastern North America, Western North America, Intermountain Region).
Factor 2 (Sex): Fixed, levels (Females, Males).
Sample size: individuals randomly selected per combination ( warblers).
Response variable: Culmen length (in ).
Complete Raw Experimental Data (Culmen Length in mm):
Females:
Eastern: (Mean \,mm)
Western: (Mean \,mm)
Intermountain: (Mean \,mm)
Males:
Eastern: (Mean \,mm)
Western: (Mean \,mm)
Intermountain: (Mean \,mm)
Tested Hypotheses:
Location main effect: vs.
Sex main effect: vs.
Interaction effect: vs.
ANOVA Output:
Source | DF | Adj SS | Adj MS | F-Value | P-Value |
|---|---|---|---|---|---|
Location | |||||
Sex | |||||
Location*Sex | |||||
Error | |||||
Total |
Model Summary:
Detailed Findings and Interpretation:
Main Effect of Location (): Highly statistically significant. Bill length is lowest overall in the Eastern population and highest in the Western population, with the Intermountain population falling intermediate.
Main Effect of Sex (): Highly statistically significant. Overall, across all geographic locations combined, female warblers have longer culmens than males.
Interaction Effect (): Highly statistically significant (), demonstrating that sex-based culmen morphology differs fundamentally across regional environments.
Interaction Morphology Pattern: Moving from east to west, male culmen length increases dramatically relative to females:
In the Eastern population, females have much longer bills than males ( vs. ).
In the Intermountain population, females remain longer than males ( vs. ).
In the Western population, the pattern reverses: average male bill length () exceeds female bill length ().
This crossing of trajectory lines provides an empirical demonstration of an interaction in ecological morphology.
Comparative Synthesis: Randomized Block vs. Factorial ANOVA
Primary Objective:
Randomized Block Design: Variance reduction. Removes nuisance variance to achieve higher test power for a single primary treatment factor.
Factorial Design: Hypothesis testing across multiple factors simultaneously. Evaluates main effects of multiple treatments and tests for potential interactions between them.
Status of the Second Factor:
Randomized Block Design: The block is not of primary scientific interest; the researcher does not intend to examine individual block contrasts except to confirm error reduction.
Factorial Design: Both treatments are variables of genuine scientific interest.
Interaction Assumptions:
Randomized Block Design: Assumes the block and treatment do not interact (interaction variance is forced into the error term).
Factorial Design: Explicitly models, isolates, and tests the interaction term () as a separate source of variance with its own degrees of freedom () and -test.
Randomization Protocol:
Randomized Block Design: Restricted randomization. Subjects are non-randomly grouped into blocks, and treatments are randomly assigned strictly within each block.
Factorial Design: Completely randomized assignment of subjects to all possible treatment combinations ().
Lecture
Field data will often have to be grouped in more than one way. ANOVA doesn’t look at means, but as variances.
Randomized Block Design - an experimental design that groups observations into blocks that remove a source of variation that would contribute to the mean square error. This will give more power.
Basically you use blocks to get rid of any variables that MAY contribute to a variability in data.
A special case of randomized block design is when we wish to make a series of repeated measurements of a response variable on the same experimental object. It’s like a paired t-test. This is usually a repeated measures ANOVA.