Skip to contents

This convenience function computes weights using the Imbens-Kalyanaraman bandwidth procedure. The code does exactly what the MATLAB code available on the author's website does.

Usage

IK_bandwidth(Y, X, threshold, kernel = c("triangular", "uniform"))

Arguments

Y

The outcomes.

X

The running variable.

threshold

The threshold.

kernel

The kernel type used to construct weights within the bandwidth.

Value

A list containing the sample weights along with optimal bandwidth.

References

Imbens, G., and Kalyanaraman, K. (2012). Optimal Bandwidth Choice for the Regression Discontinuity Estimator. The Review of Economic Studies, 79(3).

Examples

# \donttest{
n = 1000; threshold = 0
X = runif(n, -1, 1)
W = as.numeric(X >= threshold)
Y = (1 + 2*W)*(1 + X^2) + 1 / (1 + exp(X)) + rnorm(n, sd = .5)
out = IK_bandwidth(Y, X, threshold)
# }