Tutorials › Causal Inference › Local Linear Regression at a Boundary

Regression Discontinuity Designs · Tutorial 637 of 972

Local Linear Regression at a Boundary

Learn how separate weighted linear fits estimate the outcome limits at an RD cutoff, and why their intercept difference is less sensitive to boundary slopes.

Advanced 12 min read

What You'll Learn

  • Set up separate weighted least-squares regressions on either side of an RD cutoff.
  • Derive the intercept formula from the weighted normal equations.
  • Calculate a local linear RD estimate and compare it with a local constant estimate.
  • Explain why fitting a slope removes first-order boundary bias under a linear conditional mean.
  • Identify the smoothness and design conditions needed for the bias comparison.

Why Fit a Line at the Cutoff?

In a regression discontinuity (RD) design, the causal contrast of interest is the jump in the conditional mean outcome at a threshold. Estimation is challenging because observations close to the cutoff lie on only one side at a time: the left-side outcome limit must be inferred from observations below the threshold, and the right-side limit from observations at or above it. A local average on either side can therefore reflect not only the outcome limit but also the slope as observations move away from the cutoff.

A local linear RD fit addresses this by fitting a separate weighted straight line on each side and comparing the lines’ intercepts at the cutoff. The slopes are allowed to differ: the outcome trend below the threshold need not match the trend above it. This is a local estimation method, not a claim that the outcome relationship is linear over the entire range of the running variable.

Definition: Let \(X_i\) be the running variable, \(c\) the cutoff, and \(Y_i\) the outcome. Define the centered running variable \(U_i=X_i-c\). For a chosen neighborhood and nonnegative observation weights \(w_i\), the local linear RD estimator fits \(Y_i=a_-+b_-U_i\) below the cutoff and \(Y_i=a_++b_+U_i\) at or above it, minimizing weighted squared residuals separately on each side. The estimated discontinuity is \(\hat{\tau}_{LL}=\hat{a}_+-\hat{a}_-\).

The intercepts are predictions at \(U_i=0\), which is the cutoff itself. For a sharp RD design, under the usual continuity conditions that identify the causal effect from the outcome jump, the difference in the two limiting conditional means corresponds to the treatment effect at the cutoff. The regression procedure estimates that jump; it does not by itself establish the identification conditions.

From Weighted Least Squares to the Intercept

For each side \(s\in\{-,+\}\), let \(I_s\) denote the observations assigned to that side. The weighted least-squares fit chooses an intercept \(a_s\) and slope \(b_s\) to minimize the weighted sum of squared residuals:

$$ Q_s(a_s,b_s)=\sum_{i\in I_s} w_i\bigl(Y_i-a_s-b_sU_i\bigr)^2. $$

The intercept is the fitted outcome at the cutoff, while the slope describes the local change in fitted outcome per unit of the running variable on that side. To obtain the estimator, differentiate \(Q_s\) with respect to the two coefficients and set the derivatives equal to zero. Define the weighted sums \(S_{k,s}=\sum_{i\in I_s}w_iU_i^k\) and \(T_{k,s}=\sum_{i\in I_s}w_iU_i^kY_i\). The normal equations are:

$$ \begin{aligned} S_{0,s}a_s+S_{1,s}b_s&=T_{0,s},\\ S_{1,s}a_s+S_{2,s}b_s&=T_{1,s}. \end{aligned} $$

Solving this two-equation system gives the intercept. The determinant \(D_s=S_{0,s}S_{2,s}-S_{1,s}^2\) must be positive, which requires enough weighted variation in \(U_i\) on that side to distinguish a slope from an intercept.

$$ \hat{a}_s= \frac{S_{2,s}T_{0,s}-S_{1,s}T_{1,s}} {S_{0,s}S_{2,s}-S_{1,s}^2}, \qquad \hat{\tau}_{LL}=\hat{a}_+-\hat{a}_-. $$

This expression makes an important feature visible: the intercept is not generally a weighted mean of the observed outcomes. It combines the weighted outcome sums and their association with distance from the cutoff to extrapolate each side’s fitted line to \(U_i=0\).

Worked Example: Estimating a Jump from Two Local Lines

Suppose a hypothetical sharp RD analysis uses six observations. For simplicity, give all observations weight 1. On the left, the pairs \((U_i,Y_i)\) are \((-3,7),(-2,8),(-1,9)\). On the right, they are \((1,14),(2,16),(3,18)\). Fit a separate line on each side and calculate the estimated jump.

On the left, the values lie on \(Y_i=10+U_i\). Thus the fitted left intercept is \(\hat{a}_-=10\), and the fitted left slope is 1. On the right, the values lie on \(Y_i=12+2U_i\), so \(\hat{a}_+=12\) and the right slope is 2. Both intercepts are predictions at the cutoff, even though there is no observation exactly at \(U_i=0\).

The local linear estimate is:

$$ \hat{\tau}_{LL}=\hat{a}_+-\hat{a}_-=12-10=2. $$

The estimated outcome jump at the cutoff is 2 outcome units. If, for example, \(Y_i\) were measured in points, the estimate would be 2 points. The calculation allows the two sides to have different slopes rather than treating their nearby average outcomes as the cutoff limits.

Why Separate Slopes Reduce Boundary Bias

The boundary issue can be seen by comparing the fits when the conditional mean on one side is locally linear. Suppose the mean outcome on side \(s\) is \(m_s(u)=\mu_s+\beta_su\) over the observations receiving positive weight. A local constant fit estimates a weighted average of the outcomes on that side. Its expected value is \(\mu_s+\beta_s\bar{u}_{w,s}\), where \(\bar{u}_{w,s}=\sum_{i\in I_s}w_iU_i/\sum_{i\in I_s}w_i\). Because observations on one side of a boundary have distances with the same sign, \(\bar{u}_{w,s}\) is generally not zero. The local constant fit therefore includes a slope contribution instead of estimating \(\mu_s\).

By contrast, weighted least squares with an intercept and slope reproduces a linear conditional mean exactly when the model is correctly specified and \(D_s>0\). If \(Y_i=\mu_s+\beta_sU_i\), the coefficients \(a_s=\mu_s\) and \(b_s=\beta_s\) give zero residuals, so they minimize the weighted sum of squared residuals. The fitted intercept is then the cutoff value \(\mu_s\), regardless of the one-sided distribution of the running variable.

When the conditional mean is curved rather than exactly linear, a Taylor expansion near the cutoff clarifies the order of the remaining bias. Suppose \(m_s(u)=\mu_s+\beta_su+\gamma_su^2+o(u^2)\) as \(u\) approaches zero on side \(s\). For a local constant fit, the leading bias contains \(\beta_s S_{1,s}/S_{0,s}\), which is typically of order \(h\) when the observations used lie within a distance proportional to \(h\) of the cutoff. A local linear fit cancels the constant and linear terms in its intercept formula. Its quadratic contribution is proportional to:

$$ \gamma_s\frac{S_{2,s}^2-S_{1,s}S_{3,s}} {S_{0,s}S_{2,s}-S_{1,s}^2}. $$

If the weighted design has adequate variation and the distances are of order \(h\), this contribution is typically of order \(h^2\). Thus local linear fitting removes the first-order slope component that affects a local constant fit at a one-sided boundary. It does not eliminate all bias: curvature, higher-order terms, and finite-sample variation remain.

Worked Example: Unequal Weights and Exact Linear Fits

Consider a hypothetical example with right-side observations \((U_i,Y_i)=(1,12),(2,14),(3,16)\), and left-side observations \((-1,4),(-2,3),(-3,2)\). Assign weights 1, 0.5, and 0.25 to observations at distances 1, 2, and 3, respectively. Calculate the intercepts using the weighted-sum formula.

For the right side, the weighted sums are \(S_{0,+}=1+0.5+0.25=1.75\), \(S_{1,+}=1+1+0.75=2.75\), and \(S_{2,+}=1+2+2.25=5.25\). The outcome sums are \(T_{0,+}=12+7+4=23\) and \(T_{1,+}=12+14+12=38\). Therefore:

$$ \hat{a}_+ =\frac{(5.25)(23)-(2.75)(38)} {(1.75)(5.25)-(2.75)^2} =\frac{16.25}{1.625}=10. $$

For the left side, \(S_{0,-}=1.75\), \(S_{1,-}=-2.75\), and \(S_{2,-}=5.25\). Also, \(T_{0,-}=4+1.5+0.5=6\) and \(T_{1,-}=(-1)(4)(1)+(-2)(3)(0.5)+(-3)(2)(0.25)=-8.5\). Thus:

$$ \hat{a}_- =\frac{(5.25)(6)-(-2.75)(-8.5)} {(1.75)(5.25)-(-2.75)^2} =\frac{8.125}{1.625}=5. $$

The estimated jump is \(10-5=5\) outcome units. The fitted lines are exactly \(Y_i=10+2U_i\) on the right and \(Y_i=5+U_i\) on the left. The different weights do not change their intercepts because each side’s data follow an exact straight line.

How Much Can a Local Constant Fit Differ?

The difference between the methods can be substantial when the mean changes rapidly near the cutoff. A local constant estimate uses the weighted average directly, whereas the local linear estimate adjusts for the side-specific trend. The next example uses the same locations and weights as before but introduces curvature, so the linear fits no longer recover the exact cutoff values.

Worked Example: Curvature Leaves a Smaller, But Nonzero, Bias

Suppose hypothetical outcomes follow \(m_+(u)=10+2u+0.3u^2\) on the right and \(m_-(u)=5+u+0.1u^2\) on the left. Use \(U=1,2,3\) on the right and \(U=-1,-2,-3\) on the left, with respective weights 1, 0.5, and 0.25 by distance. The true jump in the two conditional means at the cutoff is \(10-5=5\).

The right-side outcomes are 12.3, 15.2, and 18.7. The weighted sums are \(T_{0,+}=12.3+7.6+4.675=24.575\) and \(T_{1,+}=12.3+15.2+14.025=41.525\). The design sums remain \(S_{0,+}=1.75\), \(S_{1,+}=2.75\), and \(S_{2,+}=5.25\), so:

$$ \hat{a}_+ =\frac{(5.25)(24.575)-(2.75)(41.525)}{1.625} =\frac{14.825}{1.625} \approx 9.123. $$

On the left, the outcomes are 4.1, 3.4, and 2.9. Here \(T_{0,-}=4.1+1.7+0.725=6.525\) and \(T_{1,-}=-4.1-3.4-2.175=-9.675\). Therefore:

$$ \hat{a}_- =\frac{(5.25)(6.525)-(-2.75)(-9.675)}{1.625} =\frac{7.65}{1.625} \approx 4.708. $$

The local linear jump estimate is \(9.123-4.708\approx4.415\), about 0.585 outcome units below the true jump of 5. Curvature produces residual bias. For comparison, the local constant weighted means are \(24.575/1.75\approx14.04\) on the right and \(6.525/1.75\approx3.729\) on the left. Their difference is about 10.31, much farther from the true jump here because it also reflects the nonzero slopes on both sides.

Conditions and Interpretation

The algebraic estimator can be computed whenever the side-specific weighted design matrices are nonsingular, but interpreting the result as an RD effect requires more. In a sharp RD design, the treatment assignment must change at the cutoff, and the conditional mean potential outcomes must be continuous there in the absence of treatment. Estimating each side’s limit with local lines also relies on enough nearby observations and a sufficiently smooth conditional mean for a local approximation to be informative. The separate-slope specification relaxes the need for a common slope; it does not repair a discontinuity in untreated outcomes or other violations of RD identification.

The weights determine which observations influence each local fit and how strongly. For this tutorial, their role is captured by the weighted least-squares equations; the essential point is that both sides are fitted separately and each intercept is evaluated at the cutoff. The choice of which observations receive weight, and the choice of how wide a neighborhood to use, affect both precision and approximation bias.

Common Mistakes

  • Comparing nearby averages instead of cutoff limits. A one-sided average generally lies away from the cutoff and can reflect the outcome slope. The local linear RD contrast is the difference between the two fitted intercepts.
  • Forcing a common slope. The left and right outcome trends can differ. Separate slopes allow each side’s local shape to be estimated without imposing equality.
  • Assuming local linear means unbiased. It removes the leading slope contribution under a linear mean and often reduces boundary bias, but curvature and finite-sample variation can remain.
  • Treating an estimator as an identification argument. A well-computed intercept difference is not automatically causal. A causal interpretation still depends on the RD continuity conditions and design.
  • Confusing the slope with the treatment effect. The local slopes describe trends in the running variable on each side. The estimated discontinuity is \(\hat{a}_+-\hat{a}_-\), the intercept difference.
Key takeaway: Local linear RD estimation is the difference between two separately estimated weighted-regression intercepts at the cutoff. Allowing a slope on each side removes the first-order boundary contribution that can distort one-sided local averages, while leaving curvature bias and the causal identification assumptions to be addressed.

Check Your Understanding

Use the definitions and derivation above to answer these questions.

  1. Why is the local linear RD estimate an intercept difference rather than a difference between the two slopes?
  2. For a locally linear conditional mean on one side, what slope contribution appears in the expectation of a local constant weighted mean?
  3. What condition on the weighted running-variable values is needed to solve for both an intercept and slope on one side?
  4. If the conditional mean is curved near the cutoff, why can the local linear intercept still have bias?
  5. Does calculating a local linear RD estimate alone establish a causal effect? State what additional kind of condition is needed.
Clinical Biostats