Original study: Sargent, L.W. & Lodge, D.M. (2014). Evolution of invasive traits in nonindigenous species: increased survival and faster growth in invasive populations of rusty crayfish (Orconectes rusticus). Evolutionary Applications 7: 949–961.
A common-garden experiment: young-of-year crayfish from native (Ohio) and invasive (Wisconsin) populations, grown in enclosures in three northern Wisconsin lakes in summer 2011. Not a textbook dataset — there is no chapter to look up, but the paper is worth reading.
You will see these data again in Homework 9 (Linear Mixed Models), where lake stops being a fixed factor and becomes a random effect.
library(skimr)library(patchwork)library(janitor)
Attaching package: 'janitor'
The following objects are masked from 'package:stats':
chisq.test, fisher.test
library(readxl)library(car)
Loading required package: carData
library(broom)library(emmeans)
Welcome to emmeans.
Caution: You lose important information if you filter this package's results.
See '? untidy'
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
✖ dplyr::recode() masks car::recode()
✖ purrr::some() masks car::some()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
theme_set(theme_light())
Assignment Overview
This homework assignment analyzes crayfish growth data from Sargent and Lodge (2014) to examine differences in growth rates between native and invasive populations of rusty crayfish (Orconectes rusticus) across different lake environments using two-way ANOVA.
Learning Objectives
By completing this assignment, you will be able to:
Understand two-way ANOVA concepts and applications
Perform exploratory data analysis for factorial designs
Conduct two-way ANOVA analysis
Test statistical assumptions for ANOVA
Interpret main effects and interactions
Create publication-quality figures
Write scientific methods and results sections
Data Description
The dataset contains growth measurements from a common garden experiment where young-of-year (YOY) rusty crayfish from native (Ohio) and invasive (Wisconsin) populations were grown in enclosures in three northern Wisconsin lakes during summer 2011.
Model Equation: Growth Rate = μ + Range + Lake + (Range × Lake) + ε
Where:
- Growth Rate = daily growth rate (mm/day)
- Range = population origin (Native vs Invasive)
- Lake = lake environment (Big vs High vs Papoose)
- Range × Lake = interaction between range and lake
- ε = random error
Hypotheses:
Main Effect
- Range:
- H₀: μ_Native = μ_Invasive (no difference in growth between ranges)
- H₁: μ_Native ≠ μ_Invasive (difference exists between ranges)
- Lake:
- H₀: μ_Big = μ_High = μ_Papoose (no difference among lakes)
- H₁: At least one lake mean differs from others
Interaction Effect:
- H₀: No interaction between Range and Lake
- H₁: Interaction exists between Range and Lake
Variables:
- Response: growth_per_day (continuous, mm/day)
- Factor 1: range (categorical, 2 levels: Native, Invasive)
- Factor 2: lake (categorical, 3 levels: Big, High, Papoose)
Part 3: Exploratory Data Analysis
3.1 Summary Statistics
# cray_df %>% group_by(range) %>% # skim()
3.2 Exploratory Visualizations
Part 4: Two-Way ANOVA Analysis
4.1 Fit the ANOVA Model
Car ANOVA for unbalanced
# Anova(????, type = 3)
4.2 Effect Sizes
The effectsize package does this in one line each — no sums of squares by hand, and it reports a confidence interval with every estimate. It is already loaded in the setup chunk at the top.
Eta-squared (η²) is the proportion of total variance explained by that term: η² = SS_term / SS_total. If η² = 0.10 for range, then 10% of the variance in growth rate is explained by whether the crayfish came from a native or invasive population.
Omega-squared (ω²) is the same idea corrected for bias. η² always overestimates a little, especially with small samples; ω² is the more honest estimate. They will be close.
Use partial = FALSE so the terms are fractions of the same total and can be compared to each other. (partial = TRUE, the default, divides each term by itself plus the residual, which is useful but does not add up to anything.)
Interpretation guidelines
Effect Size η² / ω² Interpretation
Small 0.01 1% of variance explained
Medium 0.06 6% of variance explained
Large 0.14 14% of variance explained
✏️ Your turn: Fill in from your own output, then answer the question underneath.
eta2 omega2 label
range ______ ______ ______
lake ______ ______ ______
range:lake ______ ______ ______
A term can be highly significant and still explain very little. Which of your three terms has the smallest p-value, and which has the largest effect size? Are they the same term — and if not, what does that tell you about what p-values measure?
An R script (13_factorial_anova_homework.R) with all of your code, plus the data file if you modified the original. All of the code should run top to bottom with what you turn in. (2 points)
A PDF of your final figure from Part 6, saved with ggsave(). (2 points)
Comments in the script that say what each block of code is doing and what you concluded from the output - credit will be given even if the code does not work, as long as you detail what you were trying to do. As we move further into statistics you will be expected to interpret the results, not just produce them. (2 points)
No quarto file and no rendered html are required for this assignment - a commented .R script is enough.