Tutorials › Propensity Score Matching and Instrumental Variables › Homoskedastic 2SLS Standard Errors

Two-Stage Least Squares · Tutorial 491 of 699

Homoskedastic 2SLS Standard Errors

Derive and compute conventional homoskedastic 2SLS standard errors, while learning which assumptions support them and when they can mislead.

Advanced 12 min read

What You'll Learn

  • State the structural model, instrument conditions, and homoskedasticity assumption behind the conventional covariance estimator.
  • Derive the covariance formula using the projection matrix for the instruments.
  • Distinguish the structural residuals used to estimate the error variance from fitted first-stage regressors.
  • Calculate a scalar 2SLS standard error and a coefficient standard error from a matrix covariance estimate.
  • Diagnose weak identification, heteroskedasticity, and other reasons conventional standard errors may be unreliable.
  • Compare conventional homoskedastic standard errors with OLS and robust IV alternatives.

Why 2SLS Needs Its Own Standard Error

Two-stage least squares (2SLS) uses instruments to estimate coefficients when one or more regressors are endogenous. Its coefficient estimate is not generally an ordinary least-squares estimate from the observed regressors, so its uncertainty must reflect the way the instruments identify the coefficients. Under homoskedastic errors, the conventional covariance estimator has a compact matrix form. Its simplicity is useful, but depends on assumptions that should be made explicit.

Let \(y\) be an \(n\times 1\) outcome vector, \(X\) an \(n\times k\) matrix of structural regressors, and \(Z\) an \(n\times L\) matrix of instruments, including any exogenous regressors that serve as their own instruments. The structural model is \(y=X\beta+u\). Write \(P_Z=Z(Z'Z)^{-1}Z'\) for the projection matrix onto the columns of \(Z\), assuming \(Z\) has full column rank. The 2SLS estimator is \(\hat{\beta}_{2SLS}=(X'P_ZX)^{-1}X'P_Zy\), provided \(X'P_ZX\) is invertible.

Definition: The conventional homoskedastic 2SLS covariance estimator is \(\widehat{\mathrm{Var}}(\hat{\beta}_{2SLS})=\hat{\sigma}^2(X'P_ZX)^{-1}\). A common residual-based estimate is \(\hat{\sigma}^2=\hat{u}'\hat{u}/(n-k)\), where \(\hat{u}=y-X\hat{\beta}_{2SLS}\) is the structural residual vector and \(k\) is the number of columns of \(X\). The conventional standard error for coefficient \(j\) is the square root of the \(j\)th diagonal entry of this covariance matrix.

The denominator \(n-k\) is a commonly used degrees-of-freedom convention. It does not make the residual variance estimate exactly unbiased in every finite-sample IV design. For large-sample inference, dividing by \(n\) instead has the same probability limit under standard regularity conditions. The important distinction is that \(\hat{u}\) is formed from the structural regressors \(X\), not from the first-stage fitted regressors.

Assumptions and the Covariance Formula

The formula is used under a correctly specified linear structural model, instrument validity, and identification. In particular, the instruments must satisfy the moment condition \(E[z_i u_i]=0\), where \(z_i\) and \(u_i\) denote the instrument vector and structural error for observation \(i\). The instruments must also be relevant: their population relationship with the structural regressors must be strong enough to identify the coefficients, corresponding in the sample to \(X'P_ZX\) being nonsingular. For the conventional homoskedastic variance, the error variance is constant across instrument values, \(E[u_i^2\mid z_i]=\sigma^2\). Independent observations, suitable finite moments, and a large-sample approximation support the usual standard error interpretation.

The key matrix identity follows from the 2SLS estimation error. Using \(y=X\beta+u\),

$$ \hat{\beta}_{2SLS}-\beta=(X'P_ZX)^{-1}X'P_Zu. $$

For a homoskedastic error vector with covariance matrix \(\sigma^2 I_n\), the corresponding design-based covariance calculation uses \(P_Z'=P_Z\) and \(P_Z^2=P_Z\):

$$ \begin{aligned} \mathrm{Var}(\hat{\beta}_{2SLS}) &=(X'P_ZX)^{-1}X'P_Z(\sigma^2 I_n)P_ZX(X'P_ZX)^{-1}\\ &=\sigma^2(X'P_ZX)^{-1}X'P_Z^2X(X'P_ZX)^{-1}\\ &=\sigma^2(X'P_ZX)^{-1}. \end{aligned} $$

In an IV model, endogenous regressors mean that a literal finite-sample covariance conditional on \(X\) is not generally the sampling argument of interest. The formula is conventionally understood as the homoskedastic model-based estimator, with the standard large-sample justification under valid instruments, identification, and regularity conditions. The variance \(\sigma^2\) is unknown, so it is replaced by \(\hat{\sigma}^2\) from the structural residuals. This yields the stated estimated covariance matrix.

Worked Example: A Scalar 2SLS Standard Error

Consider four hypothetical observations in a model without an intercept. There is one endogenous regressor \(x\) and one instrument \(z\), with \(z=(-1,-1,1,1)'\), \(x=(-1,0,0,2)'\), and \(y=(-1,0,0,1)'\). Suppose the population assumptions of instrument validity, relevance, and homoskedasticity are appropriate for this illustration; the small sample itself cannot establish those population conditions.

Check sample relevance and calculate the coefficient. Here \(z'z=4\), \(z'x=3\), and \(z'y=2\). Thus \(P_Z=zz'/4\), and the scalar 2SLS estimate is

$$ \hat{\beta}_{2SLS}=\frac{x'P_Zy}{x'P_Zx} =\frac{(z'x)(z'y)/(z'z)}{(z'x)^2/(z'z)} =\frac{z'y}{z'x} =\frac{2}{3}=0.6667. $$

The sample association \(z'x=3\) is nonzero, so the scalar denominator \(x'P_Zx=(z'x)^2/(z'z)=9/4=2.25\) is positive. This confirms sample identification in this one-regressor calculation, although it does not by itself show that the instrument is strong in the population.

Calculate the structural residuals. The fitted structural values are \(x\hat{\beta}_{2SLS}=(-2/3,0,0,4/3)'\), so \(\hat{u}=y-x\hat{\beta}_{2SLS}=(-1/3,0,0,-1/3)'\). Therefore \(\hat{u}'\hat{u}=2/9\). With \(n=4\) and \(k=1\), the conventional residual variance estimate is

$$ \hat{\sigma}^2=\frac{2/9}{4-1}=\frac{2}{27}=0.07407. $$

Form the coefficient variance and standard error. Since \((X'P_ZX)^{-1}=1/2.25=4/9\),

$$ \widehat{\mathrm{Var}}(\hat{\beta}_{2SLS}) =\frac{2}{27}\frac{4}{9} =\frac{8}{243}=0.03292, \qquad SE(\hat{\beta}_{2SLS})=\sqrt{\frac{8}{243}}=0.1814. $$

The estimated standard error is 0.1814 outcome units per unit of \(x\). It summarizes estimated sampling variability under the stated model; it does not measure uncertainty about whether the instrument assumptions are true.

Reading and Computing the Matrix Components

With multiple regressors, \(X'P_ZX\) is a \(k\times k\) matrix. Its inverse contains the variance scaling and covariance between coefficient estimates; multiplying by the scalar \(\hat{\sigma}^2\) gives the estimated covariance matrix. The diagonal entries are coefficient variances, while off-diagonal entries are estimated covariances. Thus, taking a square root of a diagonal entry—not an off-diagonal entry—produces an individual coefficient standard error.

Worked Example: Two Structural Coefficients

Suppose a hypothetical model has an intercept and one endogenous regressor, so \(k=2\). Let \(n=4\), and suppose the instrument matrix contains an intercept and a binary-instrument contrast \(z=(-1,-1,1,1)'\). Consider \(x=(0,1,2,3)'\) and \(y=(1,2,5,6)'\). The instrument projection gives \(P_Zx=(0.5,0.5,2.5,2.5)'\) and \(P_Zy=(1.5,1.5,5.5,5.5)'\). The fitted regressor varies across instrument groups, so the two structural coefficients are identified in this sample.

With \(X=[\mathbf{1},x]\), direct multiplication gives

$$ X'P_ZX= \begin{pmatrix} 4&6\\ 6&13 \end{pmatrix}, \qquad (X'P_ZX)^{-1} =\frac{1}{4(13)-6(6)} \begin{pmatrix} 13&-6\\ -6&4 \end{pmatrix} = \begin{pmatrix} 0.8125&-0.375\\ -0.375&0.25 \end{pmatrix}. $$

The 2SLS coefficients are the intercept \(0.5\) and slope \(2\): the instrument-group means of \(x\) are \(0.5\) and \(2.5\), while the corresponding means of \(y\) are \(1.5\) and \(5.5\), so the slope is \((5.5-1.5)/(2.5-0.5)=2\). The structural fitted values are \((0.5,2.5,4.5,6.5)'\), giving residuals \((0.5,-0.5,0.5,-0.5)'\). Their squared sum is \(1\), so \(\hat{\sigma}^2=1/(4-2)=0.5\).

The estimated covariance matrix is therefore

$$ \widehat{\mathrm{Var}}(\hat{\beta}_{2SLS}) =0.5 \begin{pmatrix} 0.8125&-0.375\\ -0.375&0.25 \end{pmatrix} = \begin{pmatrix} 0.40625&-0.1875\\ -0.1875&0.125 \end{pmatrix}. $$

The slope standard error is the square root of its diagonal variance, \(\sqrt{0.125}=0.3536\) outcome units per unit of \(x\). The negative off-diagonal entry describes estimated covariance between the intercept and slope estimates; it is not a standard error.

Worked Example: Extracting Standard Errors From a Covariance Matrix

Suppose a hypothetical analysis reports \(\hat{\sigma}^2=4\) and \((X'P_ZX)^{-1}=\begin{pmatrix}0.04&-0.01\\-0.01&0.09\end{pmatrix}\), for an intercept and a treatment coefficient. This inverse matrix is positive definite: its first diagonal element is positive and its determinant is \(0.04(0.09)-(-0.01)^2=0.0035>0\).

Multiplying by the variance estimate gives \(\widehat{\mathrm{Var}}(\hat{\beta}_{2SLS})=\begin{pmatrix}0.16&-0.04\\-0.04&0.36\end{pmatrix}\). The standard error for the treatment coefficient is \(\sqrt{0.36}=0.6000\), in outcome units per treatment unit. The intercept standard error is \(\sqrt{0.16}=0.4000\), in outcome units. The two standard errors come from the diagonal, while the covariance is \(-0.04\).

Diagnostics, Alternatives, and Limitations

The conventional formula is useful when its assumptions are credible, but it does not diagnose them automatically. Check that the instrument set and structural regressors provide full rank, and examine first-stage evidence for weak relevance. When \(X'P_ZX\) is nearly singular, its inverse can have large entries: the coefficient estimates and their standard errors may be highly sensitive to small data changes. A standard error formula does not repair weak identification or make an invalid instrument valid.

Homoskedasticity is also substantive. If the conditional error variance changes across observations, \(\hat{\sigma}^2(X'P_ZX)^{-1}\) generally does not estimate the appropriate sampling covariance. The heteroskedasticity-robust 2SLS covariance estimator replaces the common-variance simplification with observation-level residual contributions; cluster-robust or HAC covariance estimators are relevant when dependence follows those structures. These alternatives address different variance patterns and do not fix instrument validity or relevance.

Ordinary least-squares standard errors from a regression of \(y\) on first-stage fitted regressors are not a substitute for the 2SLS covariance estimator. The point estimates can coincide with 2SLS in the appropriate implementation, but treating fitted regressors as directly observed generally gives the wrong uncertainty calculation. Use the structural residuals and the \(X'P_ZX\) matrix in the conventional formula.

Common mistake: Using the second-stage OLS residual variance with the ordinary OLS inverse cross-product matrix, or treating the residuals from \(y-X\hat{\beta}_{2SLS}\) as though they made the IV covariance formula exact in every finite sample. The correction is to use the 2SLS covariance structure \(\hat{\sigma}^2(X'P_ZX)^{-1}\), state the homoskedastic and identification assumptions, and interpret it as a conventional model-based estimate with large-sample support—not as protection against weak instruments, heteroskedasticity, or invalid instruments.

The standard error quantifies estimated sampling variability conditional on the maintained statistical model. It cannot account for uncertainty about the choice or validity of instruments, omitted structural variables, or model misspecification. Those concerns require design reasoning and diagnostics in addition to a covariance calculation.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. In the conventional homoskedastic 2SLS covariance formula, what matrix is inverted, and what matrix supplies the coefficient variances?
  2. Why are the structural residuals \(y-X\hat{\beta}_{2SLS}\) used to estimate the error variance?
  3. If \(\hat{\sigma}^2=3\) and the second diagonal entry of \((X'P_ZX)^{-1}\) is \(0.16\), what is the standard error for the second coefficient?
  4. Name two conditions that the homoskedastic covariance formula does not fix when they fail.

Solutions. (1) The inverted matrix is \(X'P_ZX\); the estimated covariance matrix is \(\hat{\sigma}^2(X'P_ZX)^{-1}\), whose diagonal entries are coefficient variances. (2) The structural model defines the error as \(u=y-X\beta\), so its fitted residual estimate is \(y-X\hat{\beta}_{2SLS}\). (3) The estimated variance is \(3(0.16)=0.48\), and the standard error is \(\sqrt{0.48}=0.6928\) coefficient units. (4) It does not fix weak instrument relevance or invalid instruments; it also does not accommodate heteroskedasticity unless the variance estimator is changed.

Clinical Biostats