Tutorials › Econometrics (Graduate) › Interpreting Random-Effects Slopes

Fixed and Random Effects · Tutorial 264 of 952

Interpreting Random-Effects Slopes

Learn to decompose a random-effects slope into its within-unit and between-unit contributions and interpret it when those associations differ.

Intermediate 9 min read

What You'll Learn

  • Decompose regressor and outcome variation into within-unit and between-unit components.
  • Derive the within and between weights in the balanced-panel random-effects slope.
  • Interpret a random-effects coefficient when the two component slopes differ.
  • Calculate slopes from hypothetical panel data and check the arithmetic.
  • Distinguish a random-effects association from a purely within-unit or causal effect.
  • Recognize why a single coefficient can conceal different component relationships.

Why a Random-Effects Slope Needs Careful Interpretation

A panel regressor varies in two ways: it can change within a unit over time, and its average can differ between units. A clinic may change its staffing from year to year, for example, while also having a staffing level that is persistently higher or lower than other clinics. These are distinct sources of information, and their associations with an outcome need not be the same.

A random-effects (RE) regression uses quasi-demeaned observations. As a result, its slope generally combines within-unit and between-unit information. It is not automatically a within-unit slope, and it is not necessarily the ordinary between-unit slope either. Understanding the two components clarifies what the reported coefficient summarizes.

Model and Variation Components

For a balanced panel with \(N\) units and \(T\) observations per unit, consider the single-regressor model

$$ y_{it}=\beta x_{it}+\alpha_i+u_{it}, \qquad i=1,\ldots,N,\quad t=1,\ldots,T. $$

Here \(y_{it}\) is the outcome, \(x_{it}\) is the regressor, \(\beta\) is its slope, \(\alpha_i\) is a unit-specific component that is constant over time, and \(u_{it}\) is the remaining disturbance. An intercept could also be included; it does not change the slope decomposition below.

Definition: The unit mean is \(\bar{x}_i=T^{-1}\sum_{t=1}^T x_{it}\), and the grand mean of unit means is \(\bar{x}=N^{-1}\sum_{i=1}^N\bar{x}_i\). The within-unit deviation is \(x_{it}-\bar{x}_i\); the between-unit deviation is \(\bar{x}_i-\bar{x}\). Define \(\bar{y}_i\) and \(\bar{y}\) in the same way. Within variation describes changes around a unit’s own mean; between variation describes differences among unit means.

The usual RE interpretation relies on assumptions about the disturbances and the regressor. In particular, the unit component must be uncorrelated with the full regressor history, \(E(\alpha_i\mid x_{i1},\ldots,x_{iT})=0\), and the idiosyncratic errors must be conditionally mean-zero given that history and \(\alpha_i\). The variance-components specification treats \(\alpha_i\) as having variance \(\sigma_\alpha^2\), and \(u_{it}\) as having variance \(\sigma_u^2\), with no serial correlation in \(u_{it}\) and no correlation between the two components. These assumptions motivate the RE transformation; they are not established merely by calculating a slope.

Quasi-Demeaning and the Slope Decomposition

In a balanced panel, RE quasi-demeans each variable by subtracting a fraction \(\theta\) of its unit mean:

$$ y_{it}^{*}=y_{it}-\theta\bar{y}_i, \qquad x_{it}^{*}=x_{it}-\theta\bar{x}_i, \qquad \theta=1-\sqrt{\frac{\sigma_u^2}{\sigma_u^2+T\sigma_\alpha^2}}. $$

For positive variance components, \(0\leq\theta<1\). When \(\theta=0\), there is no demeaning; as \(\theta\) approaches 1, the transformation approaches full within-unit demeaning. The RE slope is obtained by regressing \(y_{it}^{*}\) on \(x_{it}^{*}\), with an intercept.

Result: Let \(S_{W,xx}=\sum_i\sum_t(x_{it}-\bar{x}_i)^2\) and \(S_{W,xy}=\sum_i\sum_t(x_{it}-\bar{x}_i)(y_{it}-\bar{y}_i)\). Let \(S_{B,xx}=\sum_i(\bar{x}_i-\bar{x})^2\) and \(S_{B,xy}=\sum_i(\bar{x}_i-\bar{x})(\bar{y}_i-\bar{y})\). Then, for a balanced panel with an intercept, $$ \hat{\beta}_{RE} = \frac{S_{W,xy}+T(1-\theta)^2S_{B,xy}} {S_{W,xx}+T(1-\theta)^2S_{B,xx}}. $$

The factor \(T\) is part of the between contribution because each unit mean corresponds to \(T\) observations in the transformed regression. The definitions above use sums across unit means without that factor. Keeping these conventions together prevents counting \(T\) twice.

Why the Formula Has These Weights

To see the decomposition, first center each transformed variable around its transformed grand mean. In a balanced panel, the mean of \(x_{it}^{*}\) across all observations is \((1-\theta)\bar{x}\). Therefore,

$$ x_{it}^{*}-(1-\theta)\bar{x} = (x_{it}-\bar{x}_i)+(1-\theta)(\bar{x}_i-\bar{x}). $$

The same identity holds for \(y\). When the centered transformed variables are multiplied and summed, the cross-products between within and between deviations vanish: for each unit, \(\sum_t(x_{it}-\bar{x}_i)=0\), and likewise for \(y\). The within cross-product is consequently \(S_{W,xy}\). The between cross-product is repeated \(T\) times and scaled by \((1-\theta)^2\), giving \(T(1-\theta)^2S_{B,xy}\). Applying the same expansion to the squared regressor deviations gives \(S_{W,xx}+T(1-\theta)^2S_{B,xx}\). The ordinary least-squares slope is the centered cross-product divided by the centered sum of squares, which yields the stated result.

If the separate within and between slopes are defined as \(\hat{\beta}_W=S_{W,xy}/S_{W,xx}\) and \(\hat{\beta}_B=S_{B,xy}/S_{B,xx}\), then the RE slope is a weighted average of them when both denominators are positive:

$$ \hat{\beta}_{RE} = \frac{S_{W,xx}\hat{\beta}_W+ T(1-\theta)^2S_{B,xx}\hat{\beta}_B} {S_{W,xx}+T(1-\theta)^2S_{B,xx}}. $$

The weights are nonnegative and depend on the amount of regressor variation in each component and on the quasi-demeaning factor. Thus, the RE estimate lies between the two component slopes in this one-regressor setting, unless one component has no regressor variation. It equals both component slopes when those slopes agree; otherwise, its location depends on the weights.

Worked Example: A Positive Within Slope and a Larger Between Slope

Suppose three hypothetical clinics are observed for two periods. The data are:

Clinic\(x_{i1}\)\(x_{i2}\)\(y_{i1}\)\(y_{i2}\)\(\bar{x}_i\)\(\bar{y}_i\)
A8107998
B9119111010
C101211131112

Assume the RE model conditions stated above and suppose the variance components give \(\theta=0.5\). The within deviations of \(x\) are \(-1,1\) for each clinic, so \(S_{W,xx}=3[(-1)^2+1^2]=6\). The within deviations of \(y\) are also \(-1,1\), so \(S_{W,xy}=6\). The unit means are centered at \(\bar{x}=10\) and \(\bar{y}=10\); hence \(S_{B,xx}=(-1)^2+0^2+1^2=2\) and \(S_{B,xy}=(-1)(-2)+0+(1)(2)=4\). Thus, \(\hat{\beta}_W=6/6=1\) and \(\hat{\beta}_B=4/2=2\).

Here \(T(1-\theta)^2=2(0.5)^2=0.5\). Substituting the unscaled between sums into the RE formula gives

$$ \hat{\beta}_{RE} = \frac{6+0.5(4)}{6+0.5(2)} = \frac{8}{7} \approx 1.143. $$

If \(x\) is measured in training hours and \(y\) in score points, the fitted RE slope is about 1.143 score points per training hour. It summarizes both the positive within-clinic association and the stronger positive between-clinic association; it is not equal to either component slope.

Worked Example: Opposite Within and Between Associations

Now consider another hypothetical balanced panel of three clinics, with two periods each. Let the \(x\) values be the same as in the table above. Suppose the \(y\) values are 10 and 6 for clinic A, 12 and 8 for clinic B, and 14 and 10 for clinic C. The unit means are \(\bar{x}_i=9,10,11\) and \(\bar{y}_i=8,10,12\). Assume the RE assumptions and \(\theta=0.5\).

Within each clinic, the \(x\) deviations are \(-1,1\), while the \(y\) deviations are \(2,-2\). Therefore,

$$ S_{W,xx}=3[(-1)^2+1^2]=6, \qquad S_{W,xy}=3[(-1)(2)+(1)(-2)]=-12. $$

Between the clinics, the centered means are \(-1,0,1\) for \(x\), and \(-2,0,2\) for \(y\). Thus \(S_{B,xx}=2\) and \(S_{B,xy}=4\), so the within slope is \(-12/6=-2\), whereas the between slope is \(4/2=2\). Applying the RE weight gives

$$ \hat{\beta}_{RE} = \frac{-12+0.5(4)}{6+0.5(2)} = \frac{-10}{7} \approx -1.429. $$

The RE slope is negative even though the between-unit slope is positive. In this example, the within sum of squares receives more weight than the scaled between sum of squares. The coefficient describes the RE combination, not a claim that both component associations have the same sign.

Worked Example: How the Quasi-Demeaning Factor Changes the Mix

Suppose a third hypothetical balanced-panel setting has the same component sums as the first example: \(S_{W,xx}=6\), \(S_{W,xy}=6\), \(S_{B,xx}=2\), and \(S_{B,xy}=4\). Assume \(T=2\), the RE assumptions, and variance components that produce \(\theta=0.8\). The between multiplier is now \(2(1-0.8)^2=0.08\). Therefore,

$$ \hat{\beta}_{RE} = \frac{6+0.08(4)}{6+0.08(2)} = \frac{6.32}{6.16} \approx 1.026. $$

The within slope remains 1 and the between slope remains 2, but this RE estimate is closer to the within slope than the estimate with \(\theta=0.5\). As \(\theta\) increases, the between multiplier \(T(1-\theta)^2\) decreases relative to the within contribution. This comparison illustrates how the variance-components transformation affects the mix; it does not mean that an analyst may choose \(\theta\) simply to obtain a preferred interpretation.

What the Coefficient Does—and Does Not—Mean

A random-effects slope is a model-based association that draws on both changes within units and differences between unit means. Its units are those of \(y\) per unit of \(x\). For example, a slope of 1.143 when \(y\) is measured in score points and \(x\) in training hours corresponds to an estimated 1.143 score points per training hour in the RE regression.

That wording does not by itself establish a causal effect. A causal interpretation requires a suitable identification argument in addition to the RE assumptions. In particular, if persistent unit characteristics are associated with the regressor history, the standard RE condition on \(\alpha_i\) is not satisfied. Nor does a single RE coefficient tell the reader that within and between relationships are equal: as the examples show, those component slopes can differ in size or even sign.

The formula is written for a balanced panel and one regressor so the source of the weighting is transparent. With multiple regressors, each coefficient is a partial slope conditional on the other included regressors, and the simple two-slope weighted-average description does not generally carry over coefficient by coefficient. In unbalanced panels, the transformation and weights also depend on each unit’s observation pattern.

Common Pitfall

Common mistake: “Random effects uses a unit-specific error term, so its slope must be a within-unit effect.” That conclusion is incorrect. RE quasi-demeaning subtracts \(\theta\bar{x}_i\), not the full unit mean unless \(\theta=1\). The transformed regressor retains a between-unit component whenever \(\theta<1\). Interpret the coefficient as the RE combination of within and between variation, and inspect the two component associations when they may differ.

A related arithmetic pitfall is multiplying a between sum by \(T\) twice. In the formula here, \(S_{B,xx}\) and \(S_{B,xy}\) are sums across unit means; the multiplier \(T(1-\theta)^2\) already accounts for the \(T\) repeated observations. Alternatively, one can define between sums that already include \(T\), but then the additional multiplier must be adjusted consistently.

Key takeaway: In a balanced single-regressor RE model, the slope combines within and between cross-products, with the between contribution scaled by \(T(1-\theta)^2\). Its interpretation depends on both component relationships and their effective regressor variation.

Check Your Understanding

Answer these questions using the definitions and decomposition above.

  1. In a balanced panel, what does \(x_{it}-\bar{x}_i\) measure, and what does \(\bar{x}_i-\bar{x}\) measure?
  2. If the within slope is 1 and the between slope is 3, can the single-regressor RE slope equal 1.143? What information would you need to determine its exact value?
  3. For \(T=4\) and \(\theta=0.5\), calculate the multiplier on the between sums.
  4. Why does a negative RE slope not prove that the between-unit association is negative?
  5. What assumption involving \(\alpha_i\) is needed for the standard RE interpretation, and why does computing the slope not verify it?
Clinical Biostats