Tutorials › Propensity Score Matching and Instrumental Variables › The Binary-Instrument 2SLS Calculation

Two-Stage Least Squares · Tutorial 504 of 699

The Binary-Instrument 2SLS Calculation

You will derive the binary-instrument 2SLS coefficient from group means, calculate it from hypothetical data, and identify when the calculation is undefined or lacks a causal interpretation.

Advanced 10 min read

What You'll Learn

  • Specify the one-instrument, one-regressor 2SLS model for which the mean-difference identity applies.
  • Derive the identity from the first-stage fitted values and second-stage least squares.
  • Calculate the coefficient using outcome and treatment means for the two instrument groups.
  • Recognize why a zero first-stage mean difference leaves the coefficient unidentified.
  • Distinguish the algebraic 2SLS identity from a causal interpretation of its result.
  • Compare the identity with the reduced form, first stage, and OLS.

Why a Binary Instrument Gives a Simple 2SLS Calculation

Two-stage least squares (2SLS) is often computed by regression software, but with one binary instrument and one endogenous regressor its coefficient has a direct expression in group means. The outcome difference between the two instrument groups is divided by the corresponding difference in the endogenous regressor. This identity makes the mechanics of 2SLS transparent: its numerator is the reduced-form difference, and its denominator is the first-stage difference.

The identity is an algebraic result about a particular specification. It does not, on its own, show that the instrument is valid or that the resulting coefficient has a causal interpretation. Keeping those claims separate is important: the arithmetic can be correct even when the assumptions needed for a causal conclusion are not justified.

Definition: Let \(Y_i\) be the outcome, \(D_i\) the endogenous regressor, and \(Z_i\in\{0,1\}\) the binary instrument for observation \(i\), \(i=1,\ldots,n\). Consider 2SLS with an intercept, \(D_i\) as the only regressor apart from the intercept, and \(Z_i\) as the only excluded instrument. For \(z\in\{0,1\}\), define \(\bar Y_z\) and \(\bar D_z\) as the sample means of \(Y_i\) and \(D_i\), respectively, among observations with \(Z_i=z\). If both instrument groups are nonempty and \(\bar D_1-\bar D_0\ne 0\), the 2SLS slope is \((\bar Y_1-\bar Y_0)/(\bar D_1-\bar D_0)\).

Deriving the Mean-Difference Identity

The first stage regresses \(D_i\) on an intercept and \(Z_i\). Because \(Z_i\) is binary, this regression fits one value for each instrument group. The least-squares fitted value in group \(z\) is that group’s mean of \(D_i\), so

$$ \widehat D_i=\bar D_0+(\bar D_1-\bar D_0)Z_i. $$

The second stage regresses \(Y_i\) on an intercept and \(\widehat D_i\). In a regression with an intercept, the slope is the sample cross-product of the centered regressor and outcome divided by the sum of squared centered regressor values. Write \(n_z\) for the number of observations in group \(Z_i=z\), so \(n=n_0+n_1\). Since \(\widehat D_i\) is constant within each group, the centered cross-product and sum of squares reduce to

$$ \sum_{i=1}^n(\widehat D_i-\overline{\widehat D})(Y_i-\bar Y) =\frac{n_0n_1}{n}(\bar D_1-\bar D_0)(\bar Y_1-\bar Y_0), $$
$$ \sum_{i=1}^n(\widehat D_i-\overline{\widehat D})^2 =\frac{n_0n_1}{n}(\bar D_1-\bar D_0)^2. $$

For example, the first equality follows by summing within each group: the fitted value’s deviation from its overall mean is constant within that group, and the sum of \(Y_i-\bar Y\) in that group is \(n_z(\bar Y_z-\bar Y)\). Substituting these group sums and simplifying yields the displayed expression. The second equality follows by applying the same two-group calculation to squared deviations of the fitted values.

Dividing the cross-product by the sum of squares cancels the common positive factor \(n_0n_1/n\). When \(\bar D_1-\bar D_0\ne0\), the result is

$$ \widehat\beta_{\text{2SLS}} =\frac{\bar Y_1-\bar Y_0}{\bar D_1-\bar D_0}. $$

This derivation uses the intercept and the exact first-stage specification stated above. If the first-stage difference is zero, the fitted regressor is constant and cannot identify a separate second-stage slope alongside the intercept. Also, this raw group-mean formula is not generally the formula for a specification with additional covariates.

Worked Calculations

Worked Example: Outcome and Treatment Means From Equal-Sized Groups

Suppose a hypothetical sample has four observations in each instrument group. For \(Z=0\), the treatment values sum to 1 and the outcome values sum to 40. For \(Z=1\), the treatment values sum to 3 and the outcome values sum to 52. Compute the 2SLS coefficient.

The group means are \(\bar D_0=1/4=0.25\), \(\bar D_1=3/4=0.75\), \(\bar Y_0=40/4=10\), and \(\bar Y_1=52/4=13\). Thus the first-stage difference is \(0.75-0.25=0.50\), which is nonzero, and the outcome difference is \(13-10=3\).

Substitute these values into the identity:

$$ \widehat\beta_{\text{2SLS}} =\frac{13-10}{0.75-0.25} =\frac{3}{0.50} =6. $$

The estimated 2SLS slope is 6 outcome units per one-unit increase in \(D\). This is the coefficient for this sample and specification; the calculation alone does not establish a causal effect.

Worked Example: Unequal Instrument-Group Sizes

In another hypothetical sample, three observations with \(Z=0\) have treatment total 0 and outcome total 18. Five observations with \(Z=1\) have treatment total 4 and outcome total 45. Find the coefficient, showing why unequal group sizes do not change the formula.

The group means are \(\bar D_0=0/3=0\), \(\bar D_1=4/5=0.8\), \(\bar Y_0=18/3=6\), and \(\bar Y_1=45/5=9\). The mean differences are \(0.8\) treatment units and 3 outcome units. Therefore,

$$ \widehat\beta_{\text{2SLS}} =\frac{9-6}{0.8-0} =\frac{3}{0.8} =3.75. $$

The group sizes affect the cross-product and sum of squares in the derivation through the same factor, \(n_0n_1/n=(3)(5)/8=1.875\). In this case, those quantities are \(1.875(0.8)(3)=4.5\) and \(1.875(0.8)^2=1.2\), respectively. Their ratio is \(4.5/1.2=3.75\), confirming the result. The group sizes need not be equal, but each group must contain observations.

Worked Example: A Zero First-Stage Difference

Suppose a hypothetical sample has five observations in each instrument group. In both groups the treatment mean is 0.4. The outcome means are 8 for \(Z=0\) and 10 for \(Z=1\). Can the binary-instrument 2SLS slope be calculated?

The first-stage mean difference is \(\bar D_1-\bar D_0=0.4-0.4=0\). The first-stage fitted value is therefore 0.4 for every observation. In the second stage, this constant fitted value is perfectly collinear with the intercept. Equivalently, the denominator in the mean-difference expression is zero, so the ratio would involve division by zero:

$$ \frac{\bar Y_1-\bar Y_0}{\bar D_1-\bar D_0} =\frac{10-8}{0}. $$

There is no uniquely identified second-stage slope in this setup. A nonzero outcome difference does not fix the problem: the instrument has not shifted the treatment mean in the sample. The appropriate conclusion is that this calculation does not produce a 2SLS coefficient, not that the coefficient is infinite or that the outcome difference is itself the treatment effect.

What the Identity Does—and Does Not—Establish

The numerator, \(\bar Y_1-\bar Y_0\), is the sample reduced-form difference: the outcome mean difference across instrument groups. The denominator, \(\bar D_1-\bar D_0\), is the first-stage difference: the treatment mean difference across those same groups. The ratio is the 2SLS coefficient in the stated just-identified specification. It is not the ordinary least-squares slope of \(Y_i\) on \(D_i\), which uses variation in \(D_i\) directly rather than only the variation induced by the instrument.

The algebraic identity requires nonempty groups and a nonzero first-stage difference, but those conditions alone do not validate a causal interpretation. For a causal claim, the instrument must be relevant and satisfy the appropriate exogeneity and exclusion assumptions for the model and target of interest. In particular, a difference in outcomes across instrument groups might reflect a direct effect of the instrument or a relationship between the instrument and unobserved determinants of the outcome. The ratio calculation cannot rule out either possibility.

The formula also depends on the model’s structure. With more instruments or additional covariates, 2SLS generally uses a broader projection calculation, rather than this unadjusted ratio of two raw group differences. The identity is therefore useful as a check and as an explanation of the single-instrument calculation, not as a substitute for specifying the model correctly.

Diagnostics and Common Pitfalls

  • Using the wrong groups. Compute both means using the same coding of \(Z=0\) and \(Z=1\). Swapping the labels reverses both differences, leaving their ratio unchanged; reversing only one difference is an arithmetic error.
  • Ignoring the first-stage denominator. Check \(\bar D_1-\bar D_0\) before dividing. If it is zero, the slope is not identified by this specification. A very small difference can make the numerical ratio highly sensitive to small changes in the sample; the identity alone does not quantify that uncertainty.
  • Confusing the outcome difference with the 2SLS coefficient. The coefficient divides the outcome difference by the treatment difference. Reporting only \(\bar Y_1-\bar Y_0\) omits the first-stage scale.
  • Inferring validity from a correct calculation. Software and hand calculations can agree exactly even if the instrument’s assumptions are doubtful. The algebra is not a diagnostic for exogeneity or exclusion.
  • Treating the second-stage fitted regressor as a reason to use an ordinary least-squares standard error. This identity concerns the coefficient estimate, not its standard error. 2SLS inference must use an appropriate 2SLS variance procedure; the ordinary second-stage OLS standard error is not generally valid.
Key takeaway: With an intercept, one binary instrument, and one endogenous regressor, the 2SLS slope equals the outcome mean difference across instrument groups divided by the treatment mean difference across those groups. A nonzero first-stage difference is necessary for the ratio to exist, while causal interpretation requires additional instrument assumptions.

Check Your Understanding

Answer each question using the specified one-instrument, one-regressor model. Brief solutions follow.

  1. For \(Z=0\), \(\bar Y_0=5\) and \(\bar D_0=0.2\); for \(Z=1\), \(\bar Y_1=8\) and \(\bar D_1=0.5\). What is the 2SLS coefficient?
  2. Why does the group-size factor cancel in the derivation of the coefficient?
  3. If both treatment means are 0.6 but the outcome means differ, is the 2SLS coefficient identified by the binary-instrument calculation? Explain.
  4. Does the mean-difference identity prove that the instrument has no direct effect on the outcome? Why or why not?

Solutions. (1) \((8-5)/(0.5-0.2)=3/0.3=10\) outcome units per treatment unit. (2) The second-stage cross-product is \((n_0n_1/n)(\bar D_1-\bar D_0)(\bar Y_1-\bar Y_0)\), while its sum-of-squares denominator is \((n_0n_1/n)(\bar D_1-\bar D_0)^2\); their common factor cancels. (3) No. The first-stage difference is zero, so the fitted treatment is constant and the second-stage slope is not separately identified from the intercept. (4) No. The identity is an algebraic property of 2SLS in this specification. Establishing that the instrument has no direct effect requires substantive justification of the exclusion assumption.

Clinical Biostats