penlocreg: Penalized Local Polynomial Regression

Description Usage Arguments Value Examples

View source: R/penlocreg.R

Description

Data sharpened local polynomial regression subject to a given penalty.

Usage

1
penlocreg(x, y, xgrid, degree = 0, h, lambda, L, ...)

Arguments

x

numeric vector of predictor observations

y

numeric vector of observed responses

xgrid

numeric vector of grid points where regression function is evaluated

degree

numeric vector of local polynomial regression degree

h

numeric bandwidth

lambda

numeric penalty constant

L

function related to penalty

...

additional arguments, as required by L

Value

a list containing the original observed predictor values, the sharpened responses, the smoother matrix and the penalty matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 
xx <- faithful$waiting 
yy <- faithful$eruptions 
h <- dpill(xx,yy)/2; lam <- 20  # tuning parameter selections 
yy.pen <- penlocreg(xx, yy, seq(min(xx), max(xx), len=401), lambda=lam, degree=1, h = h, L = 
    SecondDerivativePenalty) 
plot(xx, yy, xlab="waiting", ylab="eruptions", col="grey") 
title("Old Faithful")
points(yy.pen, col=2, cex=.6) # sharpened data points
lines(locpoly(xx, yy, bandwidth=h*2, degree=1), lwd=2) # local linear estimate
lines(locpoly(yy.pen$x, yy.pen$y, bandwidth=h, degree=1), col=2, lwd=2) # sharpened estimate 

CHsharp documentation built on May 1, 2019, 6:48 p.m.

Related to penlocreg in CHsharp...