Topics Covered

Continuous by Categorical Interactions

Learn to model situations where the effect of a continuous variable (like flipper_length_mm) on the outcome depends on a categorical group (like species).

Adding Interaction Terms

Use * or : in R formulas. e.g. body_mass_g ~ flipper_length_mm * species to test if regression slopes differ.

Plotting Real Interactions

Visualize the exact meaning of interaction effects with ggplot2 using geom_smooth(method="lm") colored by group.

Scripts

interaction_penguins.R

A deep dive script on fitting additive vs. interaction models on the penguins dataset, along with plotting the slopes.

Download →

Key Concepts

Homework

Resources