3 Three kinds of pooling
Code cells can be edited and re-run with “Run Code” (R is running inside your browser). The first run takes several tens of seconds to load the packages. Feel free to change numbers and see how the results change.
There are three broad ways of handling the “school offset”. Pooling means “combining the data”.
| Approach | Differences between schools | Picture |
|---|---|---|
| Complete pooling | Ignored | Treat all schools as one population |
| No pooling | Estimated completely separately for each school | Treat schools as unrelated to each other |
| Partial pooling | Different for each school, but similar | ← linear mixed model |
3.1 Complete pooling: ignore the schools
This is the lm(score ~ hours) from the previous chapter. The same line is fitted to every school.
Problem: because differences between schools are ignored, the independence assumption breaks (Chapter Chapter 1).
3.2 No pooling: estimate a separate intercept for each school
If we put school into the model as dummy variables, we can estimate a separate intercept for each school (with a common slope).
Problems:
- Even for a school with only 3–4 students, the intercept is determined by those few students alone → unstable estimates
- It does not use the information that “schools are similar”
- The number of parameters to estimate grows in proportion to the number of schools
- It says nothing about “schools other than these 20”
3.3 Partial pooling: the linear mixed model
In a linear mixed model we make the assumption that
the intercepts differ from school to school, but they come from a single distribution (a normal distribution).
3.4 Comparing the three
Let’s compare the estimated intercept of each school under “no pooling” and “partial pooling”.
Things to notice:
- The blue points (partial pooling) are pulled toward the overall mean (dashed line) compared with the red points (no pooling)
- The pull is larger for schools with fewer students (smaller red circles)
This is called shrinkage.
Suppose a school with only 3 students happens to have an extremely high mean. It is risky to believe that this is “the true ability of this school” as is. Partial pooling mixes, weighted by the amount of data, the overall information “schools are generally about like this” with “the data from these 3 students at this school”.
- Schools with lots of data → trust their own data (little shrinkage)
- Schools with little data → rely on the overall mean (strong shrinkage)
3.5 “Fixed effects” and “random effects”
The “mixed” in linear mixed model refers to mixing two kinds of effects.
- Fixed effect: a single value estimated as common to everyone
- Examples: the study-time slope \(\beta_1\), the overall intercept \(\beta_0\)
- Random effect: something that differs by group and is treated as varying according to some distribution
- Example: each school’s intercept offset \(u_j\)
- The groups can be thought of as “a sample from a population” (schools, patients, stores, participants…)
- There is a reasonably large number of groups (rule of thumb: 5–6 or more; with fewer, the variance estimate is unstable)
- You are more interested in “the variation between groups” or “the overall effect” than in the values of the individual groups themselves
In these cases a random effect is a good fit. Conversely, things like “male / female” or “drug A / drug B”, where you are interested in the levels themselves and there are few levels, should be fixed effects.
- Complete pooling: ignores the differences → independence breaks
- No pooling: completely separate → unstable estimates for groups with little data
- Partial pooling (linear mixed model): groups differ but are similar → shrinkage
- Fixed effect = a value common to everyone; random effect = a value that varies by group