Skip to contents

Local polynomial regression at user-supplied evaluation points

Usage

morie_rdd_local_polynomial(x, y, eval_points, h, p = 1, kernel = "triangular")

Arguments

x

Running variable (numeric).

y

Outcome (numeric).

eval_points

Points at which to evaluate the fit.

h

Bandwidth.

p

Polynomial order (default 1, i.e. local linear).

kernel

One of "triangular" (default), "epanechnikov", "uniform", or "gaussian".

Value

A data frame of fitted values and standard errors.

Examples

set.seed(1)
x <- runif(400, -1, 1)
y <- 0.3 * x + 1.0 * (x >= 0) + rnorm(400, sd = 0.3)
ep <- c(-0.5, 0, 0.5)
out <- morie_rdd_local_polynomial(x, y, ep, h = 0.5)
out
#>   eval_point        fit         se n_effective
#> 1       -0.5 -0.1591486 0.03039982         217
#> 2        0.0  0.4677027 0.04414890         209
#> 3        0.5  1.1652513 0.03022739         183