Week 6 - Comparing Groups
Comparing Groups as Regression
Last week ended with a magic trick: you ran a t-test, then ran the same question through lm(), and the numbers matched exactly. This week we pull the trick apart and show you the wires.
The key move is dummy coding — the trick that lets a model with only numbers in it handle a variable like “treatment group.” Once you see it, two things happen. First, the t-test stops being a separate procedure and becomes a regression with one categorical predictor. Second, ANOVA does too: three groups is just two dummy variables instead of one.
We will also deal with the question that comes up the moment you have three groups: why not just run a t-test on every pair? (Short answer: because your false-positive rate quietly climbs to 14%.)
Software picks the reference group alphabetically. Your research question almost never does. Choosing the reference group deliberately is one of the easiest ways to make a results table say what you actually mean.
Prepare
Slides
💻 Comparing Groups as Regression
Both decks cover the same concepts with the same data and the same numbers - one drives R, the other drives JAMOVI. The in-class activity gives every step both ways.
Data
Lecture: TIPI Data (.csv) - the same cleaned dataset from Week 3
In-class activity: Pokémon Data (.csv)
In-Class Activity
For Next Time
📋Lab 7 - Does the Therapy Work? — due Tuesday 10/6 at 11:59pm
A three-arm randomized trial of CBT for depression. You fit the model, choose the reference group, and write up the results.
Lab 8 is due Tuesday 10/13, which falls during Fall Break — it is submitted online as usual.
The Midterm Project is handed out 10/8 and due Tuesday 10/27.
Back to course schedule ⏎