Skip to contents

Rule-of-thumb (ROT) bandwidth – Silverman-style on running variable

Usage

morie_rdd_bandwidth_rot(x, y, cutoff = 0)

Arguments

x

Numeric vector of running-variable values (used by bandwidth selectors + density tests that don't take a data.frame).

y

Numeric vector of outcome values aligned with x.

cutoff

Numeric scalar; the threshold on running. Default 0 (the canonical normalisation).

Value

A named list with elements bandwidth, method, details.

Examples

set.seed(1)
x <- runif(400, -1, 1)
y <- 0.3 * x + 1.0 * (x >= 0) + rnorm(400, sd = 0.3)
bw <- morie_rdd_bandwidth_rot(x, y)
bw$bandwidth
#> [1] 0.3088786