Tutorials › Econometrics (Graduate) › Residual Inclusion And Two-Stage Least Squares

Endogeneity and Control Functions · Tutorial 231 of 952

Residual Inclusion And Two-Stage Least Squares

Learn why fitted-value 2SLS and linear residual inclusion can give the same coefficient, yet require careful and different standard-error calculations.

Advanced 11 min read

What You'll Learn

  • State the linear IV model and assumptions used to interpret its coefficient.
  • Derive the finite-sample coefficient equivalence between fitted-value 2SLS and residual inclusion.
  • Identify the orthogonality condition that makes the equivalence hold.
  • Distinguish second-stage OLS, residual-inclusion OLS, and 2SLS standard errors.
  • Calculate homoskedastic and robust 2SLS standard errors appropriately.
  • Recognize why matching point estimates do not validate naive standard errors.

Why the Same Coefficient Can Come From Different Regressions

In a linear instrumental-variables model, two familiar-looking procedures can produce the same estimate of the coefficient on an endogenous regressor. One regresses the outcome on the regressor’s first-stage fitted values; the other includes the original regressor and its first-stage residual. The equality is a precise consequence of the first-stage projection, not evidence that the two regressions have the same fitted values or the same uncertainty.

This distinction matters in practice. The fitted-value regression is a way to obtain the 2SLS point estimate, but its ordinary OLS standard error is generally not the 2SLS standard error. Residual inclusion also gives the same coefficient in the linear case under the stated setup, but its ordinary OLS standard error is not automatically the appropriate IV standard error either.

Model and Conditions

Let \(y_i\) be an outcome, \(x_i\) an endogenous regressor, and \(W_i\) a vector of included exogenous regressors, including an intercept. The structural equation is

$$ y_i=W_i'\gamma+\beta x_i+u_i. $$

Let \(Q_i\) be a vector of excluded instruments and \(Z_i=(W_i',Q_i')'\) the full instrument vector. For the standard linear IV interpretation, the instruments must satisfy the relevant exclusion and exogeneity conditions, expressed as \(E[Z_i u_i]=0\), and the instruments must be relevant enough to identify the coefficients. In particular, the instrumented variation in \(x_i\), after accounting for \(W_i\), must be nonzero. The required rank condition must hold for all coefficients being estimated.

For residual inclusion to represent a linear control-function model, an additional condition is needed: the conditional mean of the structural error must be representable by a linear function of the first-stage residual, so that the outcome equation can be written as \(y_i=W_i'\gamma+\beta x_i+\lambda v_i+\epsilon_i\), with the remaining error satisfying the needed conditional mean-zero condition. The IV moment conditions alone do not guarantee this conditional representation. The algebraic coefficient equality below follows from the projection, while a causal interpretation depends on the substantive IV assumptions.

Definition: Regress \(x_i\) on all columns of \(Z_i\) by OLS. Write its fitted value as \(\hat{x}_i\) and its residual as \(\hat{v}_i=x_i-\hat{x}_i\). The fitted-value regression regresses \(y_i\) on \(W_i\) and \(\hat{x}_i\); the residual-inclusion regression regresses \(y_i\) on \(W_i\), \(x_i\), and \(\hat{v}_i\).

Since \(W_i\) is included in \(Z_i\), its fitted value in the first stage is itself. The first-stage residual is therefore orthogonal in the sample to every column of \(Z\), including \(W\) and the fitted values \(\hat{x}\). In matrix notation, if \(P_Z=Z(Z'Z)^{-1}Z'\), then \(\hat{x}=P_Zx\), \(\hat{v}=(I-P_Z)x\), and \(\hat{x}'\hat{v}=0\), as well as \(W'\hat{v}=0\).

Why the Coefficients Are Equal

The key identity is \(x=\hat{x}+\hat{v}\). It makes the regressor \(x\) in the residual-inclusion regression equal to the fitted regressor plus the residual. Because \(\hat{v}\) is orthogonal to both the included regressors and \(\hat{x}\), adding \(\hat{v}\) as a control does not change the slope on \(\hat{x}\).

Theorem: With the same included regressors \(W\), and with \(\hat{x}\) and \(\hat{v}\) obtained from the OLS first stage on \(Z\) containing \(W\), the coefficient on \(\hat{x}\) in the regression of \(y\) on \(W,\hat{x}\) equals the coefficient on \(x\) in the regression of \(y\) on \(W,x,\hat{v}\). The equality is finite-sample and concerns the point estimate.

To justify the result, first remove the linear projection on \(W\) from each variable. Denote the resulting variables with a tilde. Since \(\hat{v}\) is orthogonal to \(W\), this residualization leaves \(\hat{v}\) unchanged; since \(x=\hat{x}+\hat{v}\), it gives \(\tilde{x}=\widetilde{\hat{x}}+\hat{v}\). Also \(\widetilde{\hat{x}}'\hat{v}=0\). The coefficient on \(x\) in the regression that also controls for \(\hat{v}\) is therefore

$$ \frac{\widetilde{\hat{x}}'\tilde{y}}{\widetilde{\hat{x}}'\widetilde{\hat{x}}} = \frac{\widetilde{\hat{x}}'\tilde{y}}{\widetilde{\hat{x}}'\widetilde{\hat{x}}}. $$

The expression on the left is the partial-regression formula for the residual-inclusion coefficient: controlling for \(\hat{v}\) removes the \(\hat{v}\) part of \(x\), leaving \(\widetilde{\hat{x}}\). The expression on the right is the slope in the fitted-value regression. Orthogonality is essential: without it, adding a control could change the slope.

Worked Example: Verifying the Coefficient Equality

Consider four hypothetical observations with an intercept and one instrument \(z\). Suppose the first-stage data are \(z=(0,1,2,3)'\) and \(x=(1,-2,5,2)'\). The sample means are \(\bar{z}=1.5\) and \(\bar{x}=1.5\). The first-stage slope is

$$ \frac{\sum_i(z_i-\bar{z})(x_i-\bar{x})}{\sum_i(z_i-\bar{z})^2} =\frac{5}{5}=1, \qquad \widehat{\text{intercept}}=\bar{x}-1\bar{z}=0. $$

Thus \(\hat{x}=z=(0,1,2,3)'\) and \(\hat{v}=x-\hat{x}=(1,-3,3,-1)'\). The residual sums to zero and its inner product with \(z\) is \(0-3+6-3=0\), confirming its sample orthogonality to the first-stage regressors.

Let the hypothetical outcome be \(y=(14,2,22,14)'\). In the fitted-value regression, \(\bar{y}=13\), and

$$ \hat{\beta}_{\text{fit}} =\frac{\sum_i(z_i-\bar{z})(y_i-\bar{y})}{\sum_i(z_i-\bar{z})^2} =\frac{10}{5}=2, \qquad \hat{\gamma}_{\text{fit}}=13-2(1.5)=10. $$

For residual inclusion, the fitted linear expression is \(10+2x_i+\hat{v}_i\), giving fitted values \((13,3,23,13)'\) and residuals \((1,-1,-1,1)'\). Those residuals have zero sum and have zero inner product with \(x\) and \(\hat{v}\), so the OLS coefficients are indeed intercept \(10\), coefficient on \(x\) equal to \(2\), and coefficient on \(\hat{v}\) equal to \(1\). The coefficient on \(x\) matches the fitted-value estimate, though the two regressions do not have the same fitted values.

Why Standard Errors Differ

The coefficient equality does not make the regressions interchangeable for inference. The fitted-value regression omits \(\hat{v}\), whereas residual inclusion adds it. Their residual sums of squares and residual degrees of freedom can therefore differ. More importantly, neither regression’s ordinary OLS standard error automatically accounts for the sampling variation relevant to the IV estimator.

In a homoskedastic linear IV model, let \(X=[W,x]\), \(k\) be the number of columns of \(X\), and \(\hat{u}=y-X\hat{\theta}_{2SLS}\) be the structural residuals, calculated using the original \(x\). A conventional homoskedastic 2SLS covariance estimator is

$$ \widehat{\operatorname{Var}}(\hat{\theta}_{2SLS}) = \hat{\sigma}_u^2(X'P_ZX)^{-1}, \qquad \hat{\sigma}_u^2=\frac{\hat{u}'\hat{u}}{n-k}. $$

For heteroskedasticity-robust inference, the covariance estimator uses a 2SLS sandwich based on the structural residuals and instrument moments, rather than the ordinary OLS covariance formula from either auxiliary regression. In either case, compute the 2SLS estimate and its covariance consistently with the chosen assumptions. Do not substitute the fitted-value regression’s residuals for the structural residuals simply because its coefficient is correct.

Worked Example: Three Standard Errors From One Point Estimate

Use the four-observation data from the preceding example. The fitted-value regression has fitted values \(10+2\hat{x}=(10,12,14,16)'\). Its residuals are \((4,-10,8,-2)'\), so its residual sum of squares is \(16+100+64+4=184\). It estimates two coefficients, giving \(df=4-2=2\), and the centered sum of squares of \(\hat{x}\) is \(5\). Its ordinary OLS standard error for the slope is therefore

$$ SE_{\text{fit, OLS}} = \sqrt{\frac{184/2}{5}} = \sqrt{18.4} = 4.290. $$

In residual inclusion, the fitted values are \((13,3,23,13)'\) and the residuals are \((1,-1,-1,1)'\), with sum of squares \(4\). There are three estimated coefficients, so \(df=4-3=1\). After controlling for the intercept and \(\hat{v}\), the remaining variation in \(x\) is \(\hat{x}\), whose centered sum of squares is \(5\). The ordinary OLS standard error for the coefficient on \(x\) is

$$ SE_{\text{CF, OLS}} = \sqrt{\frac{4/1}{5}} = \sqrt{0.8} = 0.8944. $$

For the homoskedastic 2SLS calculation, the structural fitted values using \(10+2x\) are \((12,6,20,14)'\). Thus \(\hat{u}=(2,-4,2,0)'\), \(\hat{u}'\hat{u}=24\), and \(n-k=4-2=2\), giving \(\hat{\sigma}_u^2=12\). Here \(X'P_ZX\) has slope information equal to the centered sum of squares \(5\), so

$$ SE_{\text{2SLS}} = \sqrt{\frac{12}{5}} = 1.549. $$

All three calculations use the same point estimate, \(2\), but produce different standard errors. Their ordering in this small hypothetical sample is not a general rule. The ordinary fitted-value and residual-inclusion standard errors use different regression residuals and degrees of freedom; neither is a substitute for the standard error appropriate to 2SLS.

Using Reported Output Carefully

In applied work, software may report a 2SLS estimate and robust standard error directly, or it may be used to run a first stage followed by a second regression. These workflows should not be confused. If the second-stage regression is ordinary OLS on \(\hat{x}\), its point estimate can equal 2SLS, but its default standard error is generally not the IV standard error. A residual-inclusion regression has a different set of regressors; its ordinary OLS standard error also requires assumptions specific to that control-function regression.

Worked Example: Interpreting a Hypothetical Output

Suppose a hypothetical sample of 200 observations produces a 2SLS estimate of \(0.42\) outcome units per unit of \(x\), with a heteroskedasticity-robust 2SLS standard error of \(0.18\). A residual-inclusion regression reports the same coefficient on \(x\), along with a coefficient of \(1.1\) on the first-stage residual. Its default OLS standard error for \(x\) is \(0.13\), while a manual fitted-value regression reports a default OLS standard error of \(0.10\).

For the stated robust 2SLS inference, the approximate large-sample statistic for testing a zero coefficient is \(0.42/0.18=2.33\). A normal-reference 95% interval is

$$ 0.42\pm1.96(0.18) = [0.0672,\;0.7728] $$

outcome units per unit of \(x\). Under the usual large-sample approximation, this interval is formed by a procedure with approximately 95% coverage under repeated sampling and the maintained IV assumptions. The two smaller default OLS standard errors do not replace the robust 2SLS standard error: they come from different covariance calculations. The residual coefficient of \(1.1\) does not, by itself, establish instrument validity or validate any particular standard error.

Common Mistakes

  • Assuming equal coefficients mean equal regressions. The residual-inclusion regression adds \(\hat{v}\), so its fitted values, residual sum of squares, and residual degrees of freedom can differ from those of the fitted-value regression.
  • Using ordinary second-stage OLS standard errors as 2SLS standard errors. The second-stage coefficient can be correct while its default OLS covariance calculation is not the appropriate IV calculation.
  • Assuming residual inclusion automatically gives valid inference. The coefficient equivalence is an algebraic fact under the specified first-stage projection. Interpretation of the control-function equation and its standard errors requires appropriate conditional-mean and sampling assumptions.
  • Forgetting included exogenous regressors in the first stage. The first stage must use the full instrument set, including the included regressors \(W\); their presence supplies the orthogonality used in the equivalence.
  • Assuming one standard error must be larger. The differences depend on the data, model, and covariance assumptions. There is no universal ordering between the naive OLS calculations and the appropriate 2SLS standard error.
Key takeaway: In the linear setup, fitted-value 2SLS and residual inclusion yield the same coefficient on the endogenous regressor because the first-stage residual is orthogonal to the instrument space. Their ordinary OLS standard errors are not thereby made equivalent or automatically valid for IV inference.

Check Your Understanding

Answer each question using the definitions and calculations above.

  1. Why must the included regressors \(W\) be part of the first-stage instrument set for the stated orthogonality argument?
  2. State the identity linking \(x\), \(\hat{x}\), and \(\hat{v}\), and explain how it helps establish coefficient equality.
  3. In the four-observation example, why do the fitted-value and residual-inclusion regressions have different residual sums of squares?
  4. Which residuals enter the conventional homoskedastic 2SLS variance calculation: the fitted-value regression residuals or the structural residuals based on \(x\)?
  5. Does equality of the two point estimates prove that the instruments are valid? Explain briefly.
Clinical Biostats