Topics Covered

Continuous + Categorical Predictors

Fit models like body_mass_g ~ flipper_length_mm + sex and interpret partial effects while controlling for the other predictor.

Two Categorical Predictors

Model mean differences with body_mass_g ~ species + sex, understand reference levels, and read dummy-coded coefficients.

Additive vs Interaction Models

Use anova() to test whether we need interaction terms like species * sex or flipper_length_mm * sex.

Scripts

mr_cont_cat.R

Tutorial for continuous outcome with one continuous predictor and one categorical predictor, including model comparison and adjusted predictions.

Download →

mr_two_cat.R

Tutorial for continuous outcome with two categorical predictors, including additive vs interaction models and predicted cell means.

Download →

mr_interact.R

Dedicated interaction-effects tutorial covering continuous * categorical and categorical * categorical models with nested comparisons.

Download →

Key Concepts

Homework

Resources