Tutorials › Propensity Score Matching and Instrumental Variables › 2SLS With Multiple Endogenous Regressors

Two-Stage Least Squares · Tutorial 486 of 699

2SLS With Multiple Endogenous Regressors

Learn to set up and calculate 2SLS for multiple endogenous regressors, and to diagnose when the instruments cannot identify their separate effects.

Advanced 12 min read

What You'll Learn

  • Distinguish the endogenous-regressor matrix from the full instrument matrix.
  • Write the joint 2SLS estimator for several endogenous regressors.
  • Check whether the instruments provide enough independent identifying variation.
  • Calculate a 2SLS estimate using projected regressors and a full set of instruments.
  • Recognize why separate one-regressor IV calculations can fail.
  • Diagnose rank failure and distinguish it from individual instrument relevance.

Why Multiple Endogenous Regressors Must Be Handled Jointly

A structural model may contain more than one regressor that is correlated with the error term. For example, an outcome might depend on two related treatment variables, each affected by unobserved factors that also affect the outcome. Instrumental variables can address this problem only if the instruments provide enough independent variation to identify the separate effects. It is not enough that each endogenous regressor is associated with some instrument when those associations do not distinguish the regressors from one another.

The key bookkeeping distinction is between the matrix of endogenous regressors and the full matrix of instruments. The first contains the variables whose structural coefficients are being estimated. The second contains all instruments used to project the structural regressors, including any included exogenous regressors.

Definition: Let \(y\) be an \(n \times 1\) outcome vector, \(A\) an \(n \times k\) matrix of included exogenous regressors (including an intercept when the model has one), and \(X_e\) an \(n \times m\) matrix of endogenous regressors. The structural regressor matrix is \(W=[A\;X_e]\), with \(p=k+m\) columns. Let \(Q\) be an \(n \times L\) matrix of excluded instruments. The full instrument matrix is \(Z=[A\;Q]\), with \(q=k+L\) columns. Thus \(X_e\) is not the full instrument matrix: it is a block of \(W\).

Assumptions and the Joint 2SLS Estimator

The linear structural equation is \(y=W\beta+u\), where \(\beta\) contains the coefficients on both the included exogenous regressors and the endogenous regressors. In the population, the standard IV conditions include a correctly specified linear conditional-mean model, instrument exogeneity \(E[Z_i u_i]=0\), and sufficient relevance to identify every coefficient. For consistency in the usual large-sample setting, observations are assumed to be independent and identically distributed with finite moments, and the population matrices must satisfy the relevant rank conditions. In particular, the instruments must be excluded from the structural equation except through the regressors, and must be uncorrelated with its error.

Endogeneity means that at least some columns of \(X_e\) are correlated with \(u\). The model does not require those columns to be uncorrelated with one another. The exogenous columns in \(A\) are included in the instrument set as well as in the structural model. This inclusion ensures that the fitted version of every structural regressor is formed using the same full instrument space.

Identification condition: In the population, the matrix \(E[Z_i W_i']\) must have column rank \(p\). In a sample calculation, the corresponding requirement is that \(W'P_ZW\) is invertible, where \(P_Z=Z(Z'Z)^{-1}Z'\), assuming \(Z\) has full column rank. A necessary counting condition is \(q \ge p\), equivalently \(L \ge m\); this count is not sufficient without the rank condition.

The projection matrix \(P_Z\) projects each column onto the column space of the full instrument matrix. The joint 2SLS estimator is

$$ \hat{\beta}_{2SLS}=(W'P_ZW)^{-1}W'P_Zy. $$

This matrix formula estimates all \(p\) coefficients together. In particular, it does not replace \(X_e\) with a single column or use a separate instrument space for each endogenous regressor. If the number of instruments exceeds the number of structural regressors, the model is overidentified; the same estimator applies, provided the rank condition holds.

Why the Projection Formula Gives a Joint Estimate

The projection formulation also provides a short justification for the estimator. Two-stage least squares chooses \(\beta\) to minimize the squared distance between the outcome and the structural regressors after projection onto the instrument space. The criterion is \((y-W\beta)'P_Z(y-W\beta)\). Because \(P_Z\) is symmetric, differentiating this quadratic with respect to \(\beta\) gives the normal equations below.

$$ \frac{\partial}{\partial \beta}(y-W\beta)'P_Z(y-W\beta) =-2W'P_Z(y-W\beta)=0, \qquad W'P_ZW\hat{\beta}=W'P_Zy. $$

When \(W'P_ZW\) is invertible, solving those equations gives the displayed 2SLS formula. This derivation also shows why rank matters: if the projected structural regressors do not span \(p\) independent directions, the normal equations cannot uniquely determine all \(p\) coefficients.

Worked Example: Checking Relevance for Two Endogenous Regressors

Suppose there are two endogenous regressors and three excluded instruments. After accounting for included exogenous regressors, suppose their population linear projections on the excluded instruments have coefficient matrix

$$ \Pi= \begin{pmatrix} 1&0\\ 0&2\\ 1&1 \end{pmatrix}. $$

The columns describe the instrument coefficients for the first and second endogenous regressors. To check whether these instruments provide two independent directions of fitted variation, check the column rank. The determinant of the submatrix formed by the first two rows is

$$ \begin{vmatrix} 1&0\\ 0&2 \end{vmatrix} =1(2)-0(0)=2\ne 0. $$

Therefore \(\Pi\) has rank 2, the number of endogenous regressors. The instruments satisfy this relevance-rank requirement for separating the two endogenous-regressor coefficients. This calculation alone does not establish instrument exogeneity or prove the other model assumptions; it checks only the rank of the stated projection coefficients.

A Fully Worked 2SLS Calculation

The next hypothetical example makes the distinction between \(X_e\) and \(Z\) explicit. There are five observations, an intercept, two endogenous regressors, and three excluded instruments. Define the following vectors:

$$ \begin{aligned} c&=(1,1,1,1,1)',\\ z_1&=(1,-1,0,0,0)',\\ z_2&=(1,1,-2,0,0)',\\ z_3&=(1,1,1,-3,0)',\\ r&=(1,1,1,1,-4)'. \end{aligned} $$

The vectors \(z_1,z_2,z_3,r\) are each orthogonal to \(c\), and they are mutually orthogonal. Let \(Z=[c\;z_1\;z_2\;z_3]\). The endogenous regressors, outcome, and structural error are defined by

$$ X_1=z_1+z_3+r,\qquad X_2=z_2+z_3+r,\qquad y=4c+2X_1-X_2+2r. $$

Adding the vectors gives \(X_1=(3,1,2,-2,-4)'\) and \(X_2=(3,3,0,-2,-4)'\). The outcome values are \(y=(9,5,10,4,-8)'\). The structural coefficient vector is \((4,2,-1)'\), and the error is \(u=2r\). Since \(r\) is orthogonal to every column of \(Z\), \(Z'u=0\) in this constructed sample. At the same time, \(X_1\) and \(X_2\) each contain \(r\), so each is correlated with \(u\). The instruments are therefore relevant in the projected regressors, and the constructed error is orthogonal to the instrument columns.

The full structural regressor matrix is \(W=[c\;X_1\;X_2]\), whereas the full instrument matrix has four columns, \(Z=[c\;z_1\;z_2\;z_3]\). Since the listed columns of \(Z\) are mutually orthogonal, projecting onto them removes the \(r\) component and retains the other components. Thus

$$ P_ZW=[c\;z_1+z_3\;z_2+z_3], \qquad P_Zy=4c+2z_1-z_2+z_3. $$

Write \(a=z_1+z_3\) and \(b=z_2+z_3\). Their inner products are \(c'c=5\), \(a'a=2+12=14\), \(b'b=6+12=18\), and \(a'b=12\); both \(a\) and \(b\) are orthogonal to \(c\). The right-hand side \(W'P_Zy\) can be calculated as \((P_ZW)'P_Zy\), giving entries \(20\), \(a'(2z_1-z_2+z_3)=4+12=16\), and \(b'(2z_1-z_2+z_3)=-6+12=6\). Therefore the normal equations are

$$ \begin{pmatrix} 5&0&0\\ 0&14&12\\ 0&12&18 \end{pmatrix} \begin{pmatrix} \hat{\beta}_0\\ \hat{\beta}_1\\ \hat{\beta}_2 \end{pmatrix} = \begin{pmatrix} 20\\16\\6 \end{pmatrix}. $$

The first equation gives \(\hat{\beta}_0=20/5=4\). The remaining equations are \(14\hat{\beta}_1+12\hat{\beta}_2=16\) and \(12\hat{\beta}_1+18\hat{\beta}_2=6\). Substituting \(\hat{\beta}_1=2\) and \(\hat{\beta}_2=-1\) gives \(28-12=16\) and \(24-18=6\), respectively. Hence the joint 2SLS coefficient estimates are \(4\) for the intercept, \(2\) for \(X_1\), and \(-1\) for \(X_2\). The example verifies the arithmetic under its constructed orthogonality and rank conditions; it is not evidence about any real study.

Worked Example: When Each Instrument Is Relevant but the Effects Are Not Separated

Suppose two endogenous regressors have projection coefficients on two excluded instruments given by

$$ \Pi= \begin{pmatrix} 1&2\\ 2&4 \end{pmatrix}. $$

Each column is nonzero, so each endogenous regressor has fitted variation from the instruments. But the second column is twice the first, and the determinant is \(1(4)-2(2)=0\). Thus \(\Pi\) has rank 1, not rank 2. The fitted values of the second endogenous regressor are exactly twice those of the first, so the instrument projections cannot distinguish their separate structural coefficients. Only a combination of the two coefficients may be identified; the two separate effects are not identified from these instruments. Adding more observations does not fix this exact rank failure. Additional valid instruments with a genuinely independent relevance pattern, or a different model, would be needed.

Implementation Checks and Common Mistakes

For multiple endogenous regressors, the first-stage projection is applied to every column of \(W\) using the same full \(Z\). The resulting matrix \(P_ZW\) has \(p\) columns; its \(m\) columns corresponding to \(X_e\) are the fitted endogenous regressors. Keeping the matrix roles clear is essential: \(X_e\) is not \(Z\), and the first-stage fitted values are not the instrument matrix itself.

  • Counting instruments without checking rank. Having at least as many excluded instruments as endogenous regressors is necessary, but instruments can still predict the regressors in proportional patterns. Check rank, not just column counts.
  • Estimating each endogenous-regressor equation in isolation. The structural effects are estimated jointly. An instrument used for one endogenous regressor can also predict another, and the joint projection and normal equations account for this overlap.
  • Leaving included exogenous regressors out of \(Z\). The full instrument matrix includes \(A\) as well as \(Q\). Omitting included exogenous regressors changes the instrument space and does not implement the specified 2SLS estimator.
  • Treating relevance as instrument validity. Rank concerns whether the instruments provide enough predictive variation. It does not establish exogeneity or the exclusion restriction.

The alternative approaches answer different questions. Ordinary least squares uses the original regressors and does not correct their correlation with the error. A scalar IV calculation is appropriate for a single endogenous coefficient under its relevant conditions, but separate scalar calculations do not generally reproduce the joint multiple-regressor 2SLS estimate. Reduced-form regressions describe how instruments relate to outcomes and regressors; the joint 2SLS formula combines those relationships to estimate the structural coefficient vector. Weak or nearly dependent first-stage patterns can also make estimates unstable even when the rank is technically full. Diagnostics can reveal warning signs, but they cannot establish instrument validity from the data alone.

Key takeaway: With \(m\) endogenous regressors, define \(X_e\) as their \(n \times m\) matrix and \(Z=[A\;Q]\) as the full instrument matrix. Project the full structural regressor matrix \(W=[A\;X_e]\) onto the column space of \(Z\), then estimate all coefficients jointly. Identification requires full rank, not merely enough instrument columns.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A model has an intercept, one exogenous regressor, and three endogenous regressors. What is the number of columns in \(W\), and what must the number of columns in \(Z\) be at minimum?
  2. There are two endogenous regressors and two excluded instruments, but the two columns of their first-stage coefficient matrix are proportional. Are the separate coefficients identified by those instruments?
  3. Why are included exogenous regressors placed in the full instrument matrix?
  4. In the worked calculation, why does projecting \(X_1\) onto \(Z\) remove \(r\)?

Solutions. (1) \(W\) has \(1+1+3=5\) columns. The necessary counting condition is that \(Z\) have at least 5 columns; the intercept and exogenous regressor contribute two, so at least three excluded instruments are needed. Full rank is also required. (2) No. Proportional columns give rank 1, so the instruments do not provide two independent directions to identify two separate coefficients. (3) They are part of the structural regressor matrix and are exogenous, so they belong in the instrument space used to project every column of \(W\). (4) By construction \(r\) is orthogonal to every column of \(Z\), so its projection onto the column space of \(Z\) is zero.

Clinical Biostats