Fixed Effects
By the end of this lesson, you should be able to: explain what a unit fixed effect and a time fixed effect remove, estimate an effect by comparing each unit with itself, and recognise the confounders that fixed effects can't handle.
Comparing each unit with itself
Lesson 2 showed how comparing different users mixes the treatment's effect with how different those users already were. Panel data, where you see the same units repeatedly over time, offers a different solution: compare each unit with itself.
If a user's sessions go up in the weeks they use a feature, compared with the weeks they don't, that comparison isn't affected by anything that stays the same about the user: their age, their job, how keen they are on the product. Those things are the same in both kinds of weeks, so they cancel out.
That's what a fixed effect does. In a regression, a unit fixed effect gives each unit its own intercept:
absorbs everything constant about unit . The coefficient is then estimated only from changes within each unit: the weeks a user used the feature against the weeks they didn't.
A time fixed effect does the same for periods. It absorbs everything that hits all units in a given period, like a holiday, a marketing campaign or a site-wide outage. Using both is the two-way fixed effects model from lesson 12.
The key strength: fixed effects remove stable differences whether or not you measured them. You don't need a column for "how keen the user is" if keenness doesn't change from week to week.
Try it
Each simulated user has a stable trait that makes them both use a feature more and score higher on the outcome. The feature itself adds 1.
Comparing all user-weeks pooled together says the feature adds about 4.87, because heavy users both use it more and score higher. Comparing each user with themselves gives about 1.03, close to the truth.
Now add a week-to-week confounder, like a busy week that makes a user both open the feature and do more of everything else. The within-user estimate climbs too: about 1.94 at a strength of 0.5. Fixed effects only remove what's fixed.