Why Slope Heterogeneity Changes the Question
A panel regression often reports one slope for a predictor observed repeatedly on several units. That single number can suggest a common response: a one-unit increase in \(x\) is associated with the same change in \(y\) for every unit. But this is a substantive restriction, not a consequence of having repeated observations. Units may have different slopes, so the relationship between \(x\) and \(y\) can vary across people, firms, regions, or other panel units.
To interpret a pooled coefficient, it matters whether its identifying variation comes from changes in \(x\) within a unit over time, differences in average \(x\) between units, or both. These sources need not tell the same story. The distinction is especially important in an unbalanced panel, where units have different numbers and patterns of observed periods.
This model describes a linear relationship separately for each unit. It does not by itself say that changes in \(x\) cause changes in \(y\). A causal interpretation requires additional design and identification assumptions. Here the aim is to clarify what a regression coefficient summarizes when the unit-specific slopes need not be equal.
Within-Unit and Between-Unit Variation
For each unit, let \(n_i\) be the number of observed periods, and define its observed means by $$ \bar{x}_i=\frac{1}{n_i}\sum_{t\in\mathcal{T}_i}x_{it}, \qquad \bar{y}_i=\frac{1}{n_i}\sum_{t\in\mathcal{T}_i}y_{it}. $$ The within-unit variation in \(x\) consists of deviations \(x_{it}-\bar{x}_i\): it measures how \(x\) changes over time for the same unit. The between-unit variation consists of differences among the unit means \(\bar{x}_i\): it measures how units with different average \(x\) compare.
These are distinct comparisons. A unit can have substantial changes over time but an average \(x\) similar to other units. Conversely, units can have very different averages even if each unit's \(x\) barely changes. A balanced or unbalanced observation pattern does not eliminate this distinction; in an unbalanced panel, each mean and each within deviation is calculated from that unit's observed periods.
There are also different ways to pool observations. A regression of \(y_{it}\) on \(x_{it}\) with one common intercept and slope uses the levels of both variables, so its variation can combine within and between differences. A pooled regression that includes a separate intercept for each unit, or equivalently demeans the variables within unit, removes the time-invariant \(\alpha_i\) and uses within-unit variation to estimate a common slope. Neither specification automatically makes unit-specific slopes equal. The coefficient in the latter is a single summary of the within-unit relationships.
Worked Example: Different Within and Between Relationships
Suppose the following hypothetical panel records two periods for each of two units. Outcomes are in outcome units, and \(x\) is measured in predictor units.
| Unit | Period | \(x_{it}\) | \(y_{it}\) |
|---|---|---|---|
| A | 1 | 1 | 2 |
| A | 2 | 2 | 4 |
| B | 1 | 10 | 10 |
| B | 2 | 12 | 16 |
Within A, an increase of 1 predictor unit accompanies an increase of 2 outcome units, so its slope is \(\beta_A=(4-2)/(2-1)=2\). Within B, the slope is \(\beta_B=(16-10)/(12-10)=3\). Thus a common within slope is not the exact relationship for both units.
For the pooled within regression, unit A has \(\bar{x}_A=1.5\) and \(\bar{y}_A=3\); unit B has \(\bar{x}_B=11\) and \(\bar{y}_B=13\). The within sums of squares for \(x\) are \(S_{xx,A}=(1-1.5)^2+(2-1.5)^2=0.5\) and \(S_{xx,B}=(10-11)^2+(12-11)^2=2\). With no residual deviations from the stated unit-specific lines, the within cross-products are \(S_{xy,A}=2(0.5)=1\) and \(S_{xy,B}=3(2)=6\). The pooled within slope is therefore $$ \hat{\beta}_{W}=\frac{S_{xy,A}+S_{xy,B}}{S_{xx,A}+S_{xx,B}} =\frac{1+6}{0.5+2}=\frac{7}{2.5}=2.8. $$ It lies between the two unit slopes and gives more weight to B, which has more within variation in \(x\).
By contrast, a line through the two unit-mean points \((1.5,3)\) and \((11,13)\) has slope \((13-3)/(11-1.5)=10/9.5\approx1.053\). This is a between-unit comparison of averages, not the pooled within slope. With only two distinct unit means, it is simply the slope joining those two points. The large difference between 2.8 and 1.053 illustrates why the source of variation must be stated when describing a pooled coefficient.
What a Pooled Within Slope Summarizes
The within estimator can be described precisely under the unit-specific-slope model. For each observed unit-period pair, subtract the unit's observed mean from both sides of the model. Because \(\alpha_i\) is constant within unit, it disappears: $$ y_{it}-\bar{y}_i =\beta_i(x_{it}-\bar{x}_i)+(u_{it}-\bar{u}_i). $$ A pooled within regression fits one coefficient to these demeaned observations. Assume the slope \(\beta_i\) is constant over the observed periods for unit \(i\), and that the within predictor is orthogonal to the demeaned disturbance in the sample (or in conditional expectation under an appropriate exogeneity assumption). The coefficient then has the following form.
The algebra follows by substituting the demeaned model into the numerator of the within regression:
Dividing by \(\sum_i S_{xx,i}\) gives the stated result. The weights are nonnegative and sum to one after normalization, but they are not generally equal across units. A unit with constant \(x\) over its observed periods has \(S_{xx,i}=0\), so it contributes nothing to this within slope. If every unit has \(S_{xx,i}=0\), the within slope is not identified: the denominator is zero.
An unbalanced panel changes which periods enter each unit's mean, and can change each \(S_{xx,i}\). Consequently it can change the unit weights as well as the set of units contributing information. The formula does not mean that the coefficient is the equally weighted average unit effect. Nor does it assert that the coefficient is the slope for a particular unit.
Worked Example: Unequal Within-Variation Weights in an Unbalanced Panel
Consider a hypothetical unbalanced panel with three observed periods for unit A and two for unit B. Suppose their outcomes follow the unit-specific lines \(y_{At}=10+1x_{At}\) and \(y_{Bt}=0+4x_{Bt}\), with no residual deviations.
| Unit | Observed \(x\) values | Observed \(y\) values | Unit slope |
|---|---|---|---|
| A | 0, 1, 2 | 10, 11, 12 | 1 |
| B | 0, 3 | 0, 12 | 4 |
For A, \(\bar{x}_A=1\), so \(S_{xx,A}=(0-1)^2+(1-1)^2+(2-1)^2=2\). For B, \(\bar{x}_B=1.5\), so \(S_{xx,B}=(0-1.5)^2+(3-1.5)^2=4.5\). The pooled within slope is $$ \hat{\beta}_{W} =\frac{2(1)+4.5(4)}{2+4.5} =\frac{20}{6.5}\approx3.077 \quad\text{outcome units per predictor unit}. $$
The equal-weight average of the two unit slopes would be \((1+4)/2=2.5\), not 3.077. The pooled within coefficient is closer to B's slope because B has more within variation in \(x\), even though B has fewer observed periods. This example separates the number of observations from the amount of identifying within variation.
When the Information Is Between Units Only
Between-unit differences can support a regression of unit averages, but they cannot substitute for within changes when the question concerns how a unit responds as its predictor changes. If \(x_{it}\) is constant within every unit, then every \(x_{it}-\bar{x}_i\) is zero. Unit effects absorb all variation in the levels of \(x\), leaving no information for a within slope.
Worked Example: Between Variation Without Within Identification
Suppose two hypothetical units are observed twice. Unit A has \(x=1\) in both periods and outcomes 2 and 3. Unit B has \(x=4\) in both periods and outcomes 8 and 9.
Their means are \((\bar{x}_A,\bar{y}_A)=(1,2.5)\) and \((\bar{x}_B,\bar{y}_B)=(4,8.5)\). A line through the unit means has slope $$ \frac{8.5-2.5}{4-1}=\frac{6}{3}=2 \quad\text{outcome units per predictor unit}. $$ That number describes the difference between these two unit averages. For the within regression, however, \(S_{xx,A}=0^2+0^2=0\) and \(S_{xx,B}=0^2+0^2=0\). Thus \(\sum_iS_{xx,i}=0\), and the within slope cannot be calculated or identified from these observations. The between slope of 2 does not resolve that lack of within variation.
Interpretation and a Common Pitfall
A pooled coefficient should be reported with its source of variation and its model specification. For example, “the pooled within estimate is 2.8 outcome units per predictor unit” describes a common-slope summary based on within-unit changes. It does not say that every unit's slope is 2.8. A levels regression without unit effects may instead use both within-unit movement and between-unit differences; its coefficient answers a different projection question.
Common pitfall: “There are many repeated observations, so the pooled slope is the typical effect within a unit.” This reasoning confuses the number of rows with the information those rows contain. Repeated observations can add little within information if \(x\) barely changes, while a few observations can provide substantial within variation. Moreover, under heterogeneous slopes, the pooled within coefficient weights unit slopes according to within variation rather than giving each unit equal weight. The correction is to identify the specification, calculate or inspect the within and between variation, and describe the coefficient as the particular pooled summary that the specification estimates.
This distinction matters in practice because a researcher may care about changes experienced by the same unit, comparisons among units, or a defined average across units. Those questions need not yield the same coefficient. Naming the variation makes the estimand more transparent and helps avoid treating an aggregate regression number as though it were a universal unit-level relationship.
Check Your Understanding
Answer each question by referring to the model and variation involved.
- In \(y_{it}=\alpha_i+\beta_i x_{it}+u_{it}\), what restriction gives slope homogeneity?
- Explain the difference between \(x_{it}-\bar{x}_i\) and \(\bar{x}_i\) as sources of variation.
- If one unit has a larger \(S_{xx,i}\) than another, how does that affect its weight in the pooled within slope?
- Can a between-unit regression of averages identify a within-unit slope when \(x\) is constant over time within every unit? Explain.
- Why does an unbalanced panel not imply equal weights across units in a pooled within regression?