Course outline

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:

Yit=αi+τ⋅Dit+εitY_{it} = \alpha_i + \tau \cdot D_{it} + \varepsilon_{it}

αi\alpha_i absorbs everything constant about unit ii. The coefficient τ\tau 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 γt\gamma_t 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.

Try it: compare each user with themselves
0246True effectAll user-weeks pooledWithin each user (fixed effects)Estimated effect
Illustrative: 2,000 users over 8 weeks. A stable trait makes some users both use the feature more and score higher. The feature itself adds 1.
Pooled comparison
4.87
mixes the stable trait into the effect
Within-user estimate
1.03
the stable trait is removed

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.