Hexa Scholar

Omitted variable bias

An open blank notebook, a pencil and a stack of books on a study desk.
An empty notebook and a stack of books on a study desk, where the lesson's example begins.

The question

Tutoring hours and solo study are correlated. How much does leaving out solo study change the tutoring slope?

Make a guess, then compare it with two fits to the same simulated data.

  1. 1 SeeGuess how far the slope moves.
  2. 2 TryChange the two inputs and compare slopes.
  3. 3 ProveBuild the slope identity.
  4. 4 ApplyCalculate and interpret slope shifts.
Before you start · 3 quick checks on slopes, centering, and residuals

Two ideas before you start

2 ideas

Hold one input fixed

Two parallel slices of a fitted plane at different values of the second input.

A fit can use two inputs at once. Freeze one input, then trace the fitted outcome as the other input changes.

Exact definition

Let \(X\) and \(Z\) be inputs and \(Y\) the outcome. The fitted expression \(a+bX+gZ\) is a plane with intercept \(a\). At a fixed value \(Z=z\), the intercept of the resulting line is \(a+gz\) and its slope in \(X\) is \(b\). The coefficient \(g\) gives the slope in \(Z\) at fixed \(X\).

Multiple ordinary least squares (OLS) chooses \(a,b,g\) to minimize the sum of squared residuals, where a residual is observed \(Y\) minus fitted \(Y\). A fit with just \(X\) and an intercept is a short fit. A fit with \(X\), \(Z\) and an intercept is a long fit.

Use a line to summarize how inputs move together

A separate fit uses the second input \(Z\) as its outcome. Its slope tells you the fitted change in \(Z\) per unit of \(X\).

Exact definition

The auxiliary regression fits \(Z\) on an intercept and \(X\). In a population with finite second moments and positive variance of \(X\), its slope is \(d=\operatorname{Cov}(X,Z)/\operatorname{Var}(X)\). If \(Z\) also has positive variance, then

\[d=\rho\,\frac{\sigma_Z}{\sigma_X}.\]

Here \(\rho\) is the correlation of \(X\) and \(Z\), and \(\sigma_X,\sigma_Z\) are their standard deviations. Correlation has no units. The auxiliary slope is in units of \(Z\) per unit of \(X\).

Fine print on centered data and population slopes

In a data set, center a column by subtracting its mean from every entry. Let \(S_{xz}\) be the sum of products of the centered \(X\) and \(Z\) columns, and let \(S_{xx}\) be the sum of squares of centered \(X\). The sample auxiliary slope is \(S_{xz}/S_{xx}\) when \(X\) varies. The least squares lesson derives this slope rule for any outcome column.

For a fit with an intercept, the residuals sum to zero. Their dot product with each included input column is zero as well. A dot product here means multiplying entries row by row and adding. OLS as a projection explains why the squared-error minimum has this property.

A population least-squares fit minimizes expected squared residual. The same equations use means and covariances in place of sample means and centered sums. A population slope describes a distribution, while a fitted sample slope describes the rows used to compute it.

1 See

Guess the shift in the tutoring slope

In a fictional study, \(X\) is weekly tutoring time, \(Z\) is weekly solo study time, and \(Y\) is an assessment index measured in points. Both inputs are measured in hours relative to their population means. The model has an additive linear mean and an independent, mean-zero error.

The calculation and simulated fits open after you pick.

2 Try

Change the two links

Start with a different population. The outcome again has an additive linear mean and a mean-zero error independent of both inputs. The question asks for the short population slope itself.

The slope explorer opens after you check your prediction.

3 Prove

Derive the slope shift for the same rows

Theorem

Use a common set of rows for both OLS fits, each with an intercept. Assume the intercept, \(X\) and \(Z\) columns are linearly independent. In particular, \(X\) varies, so the sum of squares \(S_{xx}\) defined below is positive. Denote the long coefficients on \(X\) and \(Z\) by \(b\) and \(g\), the short coefficient on \(X\) by \(c\), and the auxiliary slope of \(Z\) on \(X\) by \(d\).

Write \(x,z,y\) for the centered columns and \(e\) for the long residual column. Let \(S_{xz}=x\cdot z\), \(S_{xy}=x\cdot y\), and \(S_{xx}=x\cdot x\), using ordinary dot products. The exact difference is

\[c-b=gd.\]

The identity holds for fixed data, including a perfect fit, zero slope or zero correlation. To build it, start with the long residual, then take the dot product with the centered \(X\) column.

4 Apply

Problems

Use short minus long for signed differences. Assume both fits include intercepts, the long fit has independent predictors in the linear algebra sense, and the population summaries have finite second moments. Each question specifies whether the numbers are population summaries or coefficients fitted to the same observations.

Key point Check what each coefficient is measured in. Convert correlation to an auxiliary slope before multiplying, and use the same rows if you compare fitted coefficients.
Level Intermediate Prerequisites Least squares, centered data, and correlation Time ~25 min

Further reading