Tutorials › Propensity Score Matching and Instrumental Variables › Kernel Weights In Regression Discontinuity

Regression Discontinuity and Natural Experiments · Tutorial 585 of 699

Kernel Weights In Regression Discontinuity

Learn how common kernels weight observations around an RD cutoff, how to compare their effects, and what to check before interpreting a kernel-weighted estimate.

Advanced 12 min read

What You'll Learn

  • Define kernel weights using the running variable’s distance from the cutoff and a chosen bandwidth.
  • Calculate uniform, triangular, and Epanechnikov weights for specific observations.
  • Explain how kernel weights enter separate local linear regressions on either side of the cutoff.
  • Distinguish the role of kernel shape from the role of bandwidth.
  • Diagnose sparse support, zero weights, and unstable weighted fits near the cutoff.
  • Compare kernel weighting with uniform weighting and global polynomial fitting.

Why Weight Observations Near the Cutoff?

A regression discontinuity (RD) estimate targets the difference between the outcome limits immediately to the left and right of a cutoff. Local polynomial estimation uses observations within a chosen neighborhood to approximate those limits. But observations inside that neighborhood need not contribute equally: an observation close to the cutoff may be more informative about the cutoff limit than one near the neighborhood’s edge. A kernel specifies how those observations are weighted.

Kernel choice is a choice about relative weights, not a replacement for the RD identification conditions. The running variable must be measured relative to the cutoff, and the outcome regression must be estimated separately on each side when fitting the usual sharp RD local linear specification. The continuity conditions underlying the RD interpretation remain necessary. A kernel cannot repair a failure of identification, a misspecified design, or a lack of observations near the cutoff.

Definition: Let \(X_i\) be unit \(i\)'s running-variable value, \(c\) the cutoff, and \(h>0\) a bandwidth. The normalized distance is \(u_i=(X_i-c)/h\). A kernel function \(K(u)\) assigns a weight \(K(u_i)\) to that observation. For a compact-support kernel, observations with \(|u_i|>1\) receive zero weight.

The bandwidth \(h\) sets the neighborhood’s scale: with a compact-support kernel, it determines which observations can receive positive weight. The kernel’s shape determines how weights vary within that neighborhood. These choices are related, because changing \(h\) changes every normalized distance \(u_i\), but they are conceptually distinct.

Common Kernel Functions

Three widely used kernels are uniform (also called rectangular), triangular, and Epanechnikov. The definitions below use the conventional normalizations for which the kernel integrates to one. In weighted least squares, multiplying every weight by the same positive constant does not change the fitted coefficients, so other normalizations can yield the same regression estimates.

$$ K_{\mathrm{uniform}}(u)=\frac{1}{2}\mathbf{1}(|u|\leq 1),\qquad K_{\mathrm{triangular}}(u)=(1-|u|)\mathbf{1}(|u|\leq 1),\qquad K_{\mathrm{Epanechnikov}}(u)=\frac{3}{4}(1-u^2)\mathbf{1}(|u|\leq 1). $$

Here \(\mathbf{1}(\cdot)\) equals one when its condition is true and zero otherwise. The uniform kernel gives equal weight to every observation in the window. The triangular kernel gives the greatest weight at the cutoff and decreases linearly to zero at the edges. The Epanechnikov kernel also gives the greatest weight at the cutoff, but decreases according to a quadratic curve. All three assign zero weight outside the window.

KernelRelative weighting inside the windowWeight at \(|u|=1\)
UniformConstantPositive under the stated convention
TriangularDecreases linearly with distance from the cutoffZero
EpanechnikovDecreases quadratically with distance from the cutoffZero

For RD, kernel weights are commonly used in separate local polynomial regressions to the left and right of \(c\). In a local linear fit, each side estimates an intercept and a slope by weighted least squares. The RD estimate is the fitted right-side intercept minus the fitted left-side intercept. The intercepts represent the fitted outcome limits at \(X_i=c\); they are not generally the observed outcomes of units exactly at the cutoff.

$$ (\hat a_s,\hat b_s) = \underset{a,b}{\operatorname{argmin}} \sum_{i:\,s_i=s} K(u_i)\left[Y_i-a-bu_i\right]^2, \qquad \hat\tau_{h,K}=\hat a_{+}-\hat a_{-}, $$

In this expression, \(s_i=+\) indicates an observation on the right of the cutoff and \(s_i=-\) an observation on the left. The fitted value at the cutoff corresponds to \(u_i=0\), so the intercept \(a\) is the relevant side-specific limit. This formulation uses normalized distance \(u_i\) as the slope variable; using \(X_i-c\) instead changes the slope’s scale but not the fitted intercept at the cutoff.

Worked Example: Calculating Three Sets of Kernel Weights

Suppose the cutoff is \(c=50\), the bandwidth is \(h=10\), and three hypothetical observations have running-variable values \(X_i=42,45,\) and \(50\). Their distances from the cutoff are \(-8,-5,\) and \(0\), so their normalized distances are \(u_i=-0.8,-0.5,\) and \(0\). Calculate their weights under each kernel.

For \(X_i=42\), \(u_i=-0.8\). The uniform weight is \(0.5\), the triangular weight is \(1-0.8=0.2\), and the Epanechnikov weight is \(0.75(1-0.8^2)=0.75(0.36)=0.27\).

For \(X_i=45\), \(u_i=-0.5\). The weights are \(0.5\), \(1-0.5=0.5\), and \(0.75(1-0.5^2)=0.75(0.75)=0.5625\), respectively.

For \(X_i=50\), \(u_i=0\). The weights are \(0.5\), \(1\), and \(0.75\), respectively. Each observation lies within the window, so each receives positive weight under all three kernels. The observation at the cutoff has the largest relative weight under the triangular kernel; the uniform kernel does not distinguish its distance from the other two observations.

How Kernel Weights Affect a Fit

The next calculation isolates the consequence of changing kernel shape. It uses a local constant weighted average, not the usual local linear RD estimator. A local constant fit does not include a slope, so it can respond more strongly to changing the relative weights. The example helps make the weighting mechanism visible; it should not be taken as a substitute for the local linear specification.

Worked Example: A Weighted Average Changes With Kernel Shape

Consider three hypothetical outcome values on one side of the cutoff, at normalized distances \(u=0,0.5,1\). Let the outcomes be \(Y=10,14,30\), respectively. Use the weighted mean \(\sum_i K(u_i)Y_i/\sum_i K(u_i)\).

Under the uniform kernel, all three weights are \(0.5\). Thus the weighted mean is \([0.5(10)+0.5(14)+0.5(30)]/1.5=27/1.5=18\).

Under the triangular kernel, the weights are \(1,0.5,0\). The observation at the edge has zero weight, so the weighted mean is \([1(10)+0.5(14)]/1.5=17/1.5=11.33\).

Under the Epanechnikov kernel, the weights are \(0.75,0.5625,0\). The weighted mean is \([0.75(10)+0.5625(14)]/(0.75+0.5625)=15.375/1.3125=11.71\). The estimates differ substantially here because the large outcome at the edge receives positive weight only under the uniform kernel. In a local linear regression, slopes also affect the fitted cutoff intercept, so the estimates are not obtained by simply applying this weighted-mean calculation.

A useful algebraic fact is that a common rescaling of all weights within a fit does not affect the estimated coefficients. If every weight \(w_i\) is replaced by \(q w_i\), where \(q>0\), the weighted least-squares objective is multiplied by \(q\), leaving its minimizer unchanged:

$$ \underset{\beta}{\operatorname{argmin}}\sum_i q w_i(Y_i-Z_i^\mathsf{T}\beta)^2 = \underset{\beta}{\operatorname{argmin}}q\sum_i w_i(Y_i-Z_i^\mathsf{T}\beta)^2 = \underset{\beta}{\operatorname{argmin}}\sum_i w_i(Y_i-Z_i^\mathsf{T}\beta)^2. $$

This is why the conventional factor \(1/2\) in the uniform kernel, for example, does not affect the regression estimate. It is the pattern of relative weights that matters, not their common scale.

Why Kernel Choice Is Often Less Consequential Than Bandwidth

Within a fixed window, the kernels above differ in how they emphasize the center and edge. Changing the bandwidth, however, changes the window itself and therefore changes which observations can contribute at all. It also changes the normalized distance of every included observation. As a result, bandwidth changes can alter both the amount and the distribution of information used to estimate each cutoff limit.

For standard local linear RD estimation, common kernel choices often produce estimates with similar behavior when used with the same bandwidth and adequate data near the cutoff. This is a practical tendency, not a guarantee that estimates will be identical. Kernel shapes can differ in finite samples, and the impact can be substantial when observations are sparse, influential outcomes lie near the window edge, or the fitted regression is unstable. Theoretical precision can also depend on the kernel through constants, even when broad asymptotic properties are similar.

Worked Example: Local Linear Fits Recover a Jump Under Exact Lines

Suppose hypothetical observations lie at distances \(X_i-c=-3,-2,-1\) to the left, with outcomes \(4,6,8\), and at distances \(1,2,3\) to the right, with outcomes \(15,17,19\). Let \(h=4\). On the left, the outcomes follow \(Y=10+2(X_i-c)\); on the right, they follow \(Y=13+2(X_i-c)\).

The normalized distances on either side have absolute values \(0.25,0.5,0.75\). Each is strictly inside the window, so all three kernels give positive weights to every observation. A weighted local linear regression on the left fits the line with intercept \(10\) at the cutoff and slope \(2\); on the right it fits intercept \(13\) and slope \(2\). These lines give zero residual for every observation. Because each side has at least two distinct running-variable values with positive weights, its linear coefficients are uniquely determined.

The estimated discontinuity is therefore \(\hat\tau_{h,K}=13-10=3\) outcome units under each kernel. In this deliberately exact example, changing the relative weights cannot change the line that fits every point. Real outcomes will generally not lie exactly on side-specific lines, so changing the weights can change the estimated intercepts.

This example also clarifies why a difference between kernel estimates is not, by itself, evidence that one kernel is invalid. The estimates summarize different weighted fits to the available data. A pronounced change across reasonable kernels may instead be a warning to inspect support, influential observations, bandwidth, and model stability.

Diagnostics, Alternatives, and Limitations

After fitting a kernel-weighted RD model, inspect the data and the fit separately on each side. Check that there are observations close to the cutoff, that the weighted design matrix can identify the requested polynomial, and that the result is not being driven by one or two observations. A fit may be numerically computable but practically unstable if most effective information comes from very few units.

One descriptive diagnostic is the effective sample size of the nonnegative weights on a side:

$$ n_{\mathrm{eff}}=\frac{\left(\sum_i w_i\right)^2}{\sum_i w_i^2}, \qquad w_i=K(u_i). $$

It equals the number of observations when all positive weights are equal and decreases when weight is concentrated on a few observations. It is only a summary of weight concentration, not a substitute for checking the running-variable support or the regression’s uncertainty. Report the kernel and bandwidth so that the weighting rule is reproducible.

The uniform kernel is equivalent to giving equal weight to all observations inside the chosen window. It is a useful baseline, but observations near the window boundary can have substantial leverage. Triangular weighting downweights those observations and is a common choice for local linear RD. Epanechnikov weighting offers another smooth decline. No kernel eliminates the need to assess the fit itself.

A global polynomial fit is an alternative modeling strategy, not merely a different kernel: it uses a broader range of running-variable values and imposes a functional form over that range. Local kernel weighting instead emphasizes observations near the cutoff. A local constant fit is another alternative within the window, but unlike local linear regression it does not account for a local slope. These approaches answer the same cutoff question only under appropriate modeling and identification conditions; they should not be treated as interchangeable by default.

Common warning signs include very few positive-weight observations on one side, a nearly singular weighted regression design, a large shift when a single observation is removed, and sharply different estimates across kernels at the same bandwidth. Kernel choice is also constrained by the chosen support convention: for triangular and Epanechnikov kernels, an observation exactly at \(|u|=1\) receives zero weight, while the stated uniform convention gives it positive weight. With continuous running variables, exact boundary observations are typically uncommon, but the convention can matter in finite samples.

The practical lesson is measured: select and report a defensible bandwidth, use a standard kernel, and check whether conclusions are sensitive to reasonable alternatives. Kernel weighting changes how the local data contribute; it does not establish continuity, prevent manipulation, or guarantee an unbiased estimate. Those questions require separate design and diagnostic reasoning.

Key takeaway: The kernel determines relative weights within the local window, while the bandwidth largely determines the window’s scale and included support. Common kernels often give similar local linear RD estimates, but sparse or influential data can make kernel choice consequential.

Check Your Understanding

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

  1. With \(h=8\), an observation is 4 running-variable units from the cutoff. Find \(u\) and its uniform, triangular, and Epanechnikov weights.
  2. Why does multiplying every weight in one weighted regression by the same positive constant leave the estimated coefficients unchanged?
  3. What does the bandwidth change that the kernel shape, considered by itself at a fixed bandwidth, does not?
  4. Name two diagnostics that can reveal an unstable kernel-weighted RD fit.

Solutions. (1) The absolute normalized distance is \(|u|=4/8=0.5\). The weights are \(0.5\), \(1-0.5=0.5\), and \(0.75(1-0.5^2)=0.5625\), respectively. (2) Multiplying all weights by a positive constant multiplies the whole weighted least-squares objective by that constant but does not change its minimizer. (3) At fixed \(h\), the kernel changes relative weights within the window; changing \(h\) changes the window’s scale, the normalized distances, and potentially which observations receive positive weight. (4) Examples include very few positive-weight observations on one side, a nearly singular weighted design matrix, a small effective sample size, or strong sensitivity to removing one observation.

Clinical Biostats