l21-Comprehensive Guide to Two-Way Factorial ANOVA and Experimental Design

Career Paths in Data Collection and Analysis

  • Perspective on Data Collection: Students are encouraged to recognize themselves as potential data collectors. The datasets used throughout the semester are derived from real research projects or inspired by actual scientific inquiries.

  • Potential Career Avenues:

    • Postgraduate Students: Individuals pursuing Honors, Masters, or PhD degrees are heavily involved in both the collection and analysis of empirical data.

    • Academic Researchers: Professionals working within universities and hospitals research environments.

    • Governmental and Public Organizations: Entities that conduct public research and policy analysis.

    • Industry and Private Sector: This includes research and development (R&D) departments within various companies.

    • Conservation Groups: Organizations focused on environmental monitoring and ecological data collection.

  • Skill Application: The skills developed in during the university bachelor's degree (often roughly halfway through a three-year program) are the foundational tools used in these professional research paths.

Learning Objectives

  • Understand and define factorial experimental designs.

  • Learn the methodology for partitioning variation in models containing two categorical predictor variables.

  • Develop the ability to interpret interaction plots and Analysis of Variance (ANOVA) tables for models with two categorical predictors.

Introduction to Factorial Experimental Design

  • Definition: A factorial design occurs when each level of one independent variable is combined with every level of the other independent variables. This creates a combinatorial set of all possible conditions.

  • Notation: Designs are described by the number of levels in each factor:

    • 2 by 2 (2×22 \times 2): Two factors, each with two levels, resulting in 4 combinations.

    • 2 by 3 (2×32 \times 3): One factor with two levels and one with three levels, resulting in 6 combinations.

    • 3 by 3 (3×33 \times 3): Two factors, each with three levels, resulting in 9 combinations.

  • Combinatorial Logic: In a standard 2×22 \times 2 design with Factors A (levels a1,a2a1, a2) and B (levels b1,b2b1, b2), the four resulting groups are:

    1. a1a1 and b1b1

    2. a2a2 and b1b1

    3. a1a1 and b2b2

    4. a2a2 and b2b2

Case Study: Intertidal Habitat Research

  • Research Question: How do herbivores affect the abundance of plants/algae in the intertidal habitat of coastal Washington state?

  • Experimental Factors:

    • Factor 1: Tidal Height (Location): Low tide mark vs. Mid tide mark. Mid-tide sites are generally less exposed to the ocean environment than low-tide marks.

    • Factor 2: Herbivore Exclusion: Herbivores (snails, limpets, and other intertidal creatures) are either excluded from a plot or allowed to remain (not excluded).

  • Experimental Setup:

    • 32 plots were established at the low tide mark.

    • 32 plots were established at the mid tide mark.

    • Herbivores were excluded from a randomly selected half of the plots in each tidal zone.

  • Data Type: Two categorical predictors (Tidal Height and Exclusion Status) and one continuous numeric response variable (Plant Abundance/Area).

Mathematical Modeling of Two-Way ANOVA

  • Linear Model Equation: The numeric variable yy is modeled as a function of the overall mean, individual factor effects, and the interaction effect:

    • y=μ+effectA+effectB+interactionA×B+errory = μ + \text{effect}_A + \text{effect}_B + \text{interaction}_{A \times B} + \text{error}

    • Where μμ is the constant or overall mean of the response variable.

  • Formula Notation: In statistical software like R, this model is condensed into a shorthand formula:

    • yABy \sim A ∗ B

    • The asterisk (*) acts as a multiplication sign, signaling to the model to include the independent effects of A, the independent effects of B, and the interaction effect between A and B.

  • Implementation in R: For the algae dataset, the code would be:

    • model <- lm(sqrt_area ~ height * herbivores, data = algae)

    • Note: The response variable in this specific study was the square root of the plant area measurement.

Information Types in Factorial Design

  1. Treatment Effect (Overall Model Effect): Determines if the overall model performs better than what would be expected by random chance or error.

  2. Interaction Effect: Evaluates whether the effect of one factor depends on the level of the other factor.

  3. Main Effects: The independent effects of each factor considered separately.

Visualizing Data and Interactions

  • Box Plots: Useful for visualizing raw data across the four combinatorial groups (e.g., Low Exc, Mid Exc, Low Non-Exc, Mid Non-Exc). Overlapping interquartile ranges suggest a lack of significant difference.

  • Interaction Plots: Plots the means (estimates from the model) for each combinatorial group. Lines are drawn to connect the means of one factor across the levels of the second factor.

  • Interaction Plot Interpretations:

    • No Effect: Lines are flat (horizontal) and virtually overlapping. No difference between A and B, and no difference between Group 1 and Group 2.

    • Single Main Effect: Parallel lines that are substantially separated. One factor causes a shift in the mean, while the other factor's levels show no difference.

      • Graphical variation: Parallel lines with a significant slope where lines overlap indicates the factor on the x-axis has an effect, but the factor represented by different colored/styled lines does not.

    • Two Main Effects: Parallel lines that are separated and have a non-zero slope. Both factors influence the response variable independently, without interacting.

    • Interaction Effect: Lines that cross or intersect. This indicates that the direction or magnitude of a factor's effect changes depending on the category of the other variable. If an interaction is present, main effects cannot be interpreted in isolation.

Partitioning Variation in Two-Way ANOVA

  • Sums of Squares (SS): The total variation (SSTotalSS_{\text{Total}}) is divided into Explained and Unexplained (Error) components.

  • Explained Variation Components:

    1. SSASS_A (Variation attributed to Factor A)

    2. SSBSS_B (Variation attributed to Factor B)

    3. SSABSS_{AB} (Variation attributed to the Interaction)

  • Degrees of Freedom (df):

    • dfA=a1df_A = a - 1 (where aa is number of levels in Factor A)

    • dfB=b1df_B = b - 1 (where bb is number of levels in Factor B)

    • dfAB=(a1)×(b1)df_{AB} = (a - 1) \times (b - 1)

    • dfError=n(a×b)df_{\text{Error}} = n - (a \times b)

  • Mean Squares (MS): Calculated for each component by dividing the Sum of Squares by the corresponding Degrees of Freedom:

    • MS=SSdfMS = \frac{SS}{df}

  • F-Statistics: Calculated for each of the three explained components by dividing the Mean Square of the component by the Error Mean Square:

    • F=MScomponentMSErrorF = \frac{MS_{\text{component}}}{MS_{\text{Error}}}

Interpreting the ANOVA Table

  • Reading Direction: The table should always be read from the bottom up.

  • Interaction Priority: Check the interaction term first. If the p-value is significant (typically p < 0.05) and the F-statistic is substantially larger than 1, stop and interpret only the interaction. Do not interpret main effects if a significant interaction exists.

  • Case Study Results (Algae):

    • Intertidal height and herbivore exclusion showed a significant interaction (p < 0.05, high F-statistic).

    • Specific Findings: The largest algal area occurred with no herbivores in the low tide zone. However, in the mid tide zone, the relationship flipped, and area was higher when herbivores were present.

Overall Model Fit and Statistics

  • Summarizing Overall Fit: Unlike a one-way ANOVA, which provides a single F-statistic, a two-way ANOVA provides specific F-statistics for each component. To find the overall model fit:

    • Mean Squares Model: MSModel=SSA+SSB+SSABdfA+dfB+dfABMS_{\text{Model}} = \frac{SS_A + SS_B + SS_{AB}}{df_A + df_B + df_{AB}}

    • Overall F-Statistic: Comparison of MSModelMS_{\text{Model}} vs. MSErrorMS_{\text{Error}}.

  • R-Squared (R2R^2): Represents the proportion of total variation in yy explained by the entire model:

    • R2=SSA+SSB+SSABSSTotalR^2 = \frac{SS_A + SS_B + SS_{AB}}{SS_{\text{Total}}}

  • Summary Output (Algae example):

    • Final Result: Proportion of variation explained was approximately 23%23\%.

    • The overall p-value was 0.0130.013, which is less than the alpha level (α=0.05α = 0.05). We reject the null hypothesis and conclude the model fits better than a random chance model.

Questions & Discussion

  • Question 1: Calculating F-statistics from a partial ANOVA table.

    • Scenario: Incomplete table where the interaction SSAB=32SS_{AB} = 32, interaction df=1df = 1, error SS=2SS = 2, and error df=4df = 4.

    • Calculation:

      • MSinteraction=321=32MS_{\text{interaction}} = \frac{32}{1} = 32

      • MSerror=24=0.5MS_{\text{error}} = \frac{2}{4} = 0.5

      • F=320.5=64F = \frac{32}{0.5} = 64

    • Conclusion: Since 64 is much larger than 1, an interaction effect is highly likely.

  • Question 2: Interpreting an interaction plot with Moisture (Wet/Dry) and Temperature (Low/High).

    • Observation: The plot shows two correct interpretations regarding main effects. Wet had a higher yy value than Dry in both cases. Low temperature had a higher yy value than High temperature in both cases. While the lines were not perfectly parallel, these are primarily two significant main effects. Substantially different slopes would be required to diagnose a strong interaction.

  • Question 3: Lab Support Materials.

    • The lecturer highlighted the existence of "take home point" videos for every lab. These are short (5 minutes or less) videos intended to summarize the big-picture takeaways for each week's laboratory assignment.