Description Usage Arguments Value Examples
Data sharpened local polynomial regression subject to a given penalty.
1 |
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 |
a list containing the original observed predictor values, the sharpened responses, the smoother matrix and the penalty matrix
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.