cv.bandwidth: Cross-validation bandwidth

View source: R/cv.bandwidth.R

cv.bandwidthR Documentation

Cross-validation bandwidth

Description

cv.bandwidth implements the cross-validation bandwidth selection rule. The function rdq.bandwidth calls this function to obtain the CV bandwidth.

Usage

cv.bandwidth(y, x, z, dz, x0, val, xl, order, bdy)

Arguments

y

a numeric vector, the outcome variable.

x

the running variable.

z

additional covariates.

dz

the number of covariates z.

x0

the cutoff point.

val

a set of candidate values for the CV bandwidth.

xl

if xl=0.5, the CV bandwidth is computed using the 50% of observations closest to x_0.

order

either 1 or 2. When order=1, a local linear regression is used, and when order=2, a local quadratic regression is used.

bdy

either 0 or 1. When bdy=1, the CV bandwidth is computed by treating x as a boundary point. Otherwise, x is treated as an interior point.

Value

A list with elements:

h.cv

the selected CV bandwidth values at the median.

cand

values of the criterion function evaluated at each of candidate value.

References

Zhongjun Qu, Jungmo Yoon, Pierre Perron (2024), "Inference on Conditional Quantile Processes in Partially Linear Models with Applications to the Impact of Unemployment Benefits," The Review of Economics and Statistics; https://doi.org/10.1162/rest_a_01168

Zhongjun Qu and Jungmo Yoon (2019), "Uniform Inference on Quantile Effects under Sharp Regression Discontinuity Designs," Journal of Business and Economic Statistics, 37(4), 625–647; https://doi.org/10.1080/07350015.2017.1407323

See Also

rdq.bandwidth

Examples

n = 500
x = runif(n,min=-4,max=4)
d = (x > 0)
y = x + 0.3*(x^2) - 0.1*(x^3) + 1.5*d + rnorm(n)
cv.bandwidth(y=y, x=x, z=NULL, dz=0, x0=0, val=c(1,2,3,4), xl=0.5, order=2, bdy=1)
cv.bandwidth(y=y, x=x, z=NULL, dz=0, x0=0, val=c(1,2,3,4), xl=0.5, order=1, bdy=1)


QTE.RD documentation built on Aug. 30, 2025, 9:06 a.m.