Skip to contents

Local linear rather than local constant is not a refinement: a kernel mean at a boundary point is biased at first order because the data lie on one side only, and the linear term removes that bias. The triangular kernel is the boundary-optimal one for this estimand.

Usage

Rdksrn(y, x, cutoff = 0, bandwidth = 1)

Arguments

y

Outcome.

x

Running variable.

cutoff

Threshold.

bandwidth

Half-window, positive.

Value

List with estimate, tau, se, z, mu_right, mu_left, slope_right, slope_left, n_right, n_left, bandwidth.

Details

Formula: tau = lim_{x -> c+} E[Y|X=x] - lim_{x -> c-} E[Y|X=x], each limit the intercept of a triangular-kernel weighted line fit on its own side.

References

Hahn, J., Todd, P. & Van der Klaauw, W. (2001). Identification and estimation of treatment effects with a regression-discontinuity design. Econometrica 69(1):201-209. doi:10.1111/1468-0262.00183 .

Examples

set.seed(1)
r <- Rdksrn(y = rnorm(10), x = rnorm(10)); TRUE
#> [1] TRUE