CVsharp: Cross-Validation Bandwidth Selector for Local Polynomial...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Cross-validation bandwidth selector for iterated sharpened responses for bias reduction in function estimation.

Usage

1
CVsharp(x, y, deg, nsteps)

Arguments

x

a numeric vector containing the predictor variable values.

y

a numeric vector containing the response variable values.

deg

a numeric vector containing the local polynomial degree used.

nsteps

a numeric vector containing the number of iteration steps.

Details

If nsteps is specified to be 0, then the CV bandwidth for conventional local polynomial regression is provided.

Value

a list containing 3 elements: the candidate bandwidths; the corresponding CV scores; the selected optimal bandwidth.

Author(s)

W.J. Braun

See Also

locpoly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
speed <- MPG[, 1]
mpg <- MPG[, 2]
h <- CVsharp(speed, mpg, 0, 0)$CVh # conventional local constant regression bandwidth
mpg.l0 <- locpoly(speed, mpg, bandwidth=h, degree=0)
h <- CVsharp(speed, mpg, 0, 1)$CVh # 1-sharpened local constant regression bandwidth
mpgSharp <- sharpiteration(speed, mpg, 0, h, 1)
mpg.l1 <- locpoly(speed, mpgSharp[[1]], bandwidth=h, degree=0)
h <- CVsharp(speed, mpg, 0, 5)$CVh # 5-sharpened local constant regression bandwidth
mpgSharp <- sharpiteration(speed, mpg, 0, h, 5)
mpg.l5 <- locpoly(speed, mpgSharp[[5]], bandwidth=h, degree=0)
plot(mpg ~ speed)
lines(mpg.l0)  # unsharpened function estimation
lines(mpg.l1, col=2, lty=2)  # sharpened function estimation (1 steps)
lines(mpg.l5, col=4, lty=3)  # sharpened function estimation (5 steps)

Example output

Loading required package: KernSmooth
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
Loading required package: quadprog

sharpData documentation built on March 30, 2021, 9:06 a.m.

Related to CVsharp in sharpData...