| relsharpen {sharpPen} | R Documentation | 
Ridge/Enet/LASSO Sharpening via the penalty matrix.
Description
This is a data sharpening function to remove roughness, prior to use in local polynomial regression.
Usage
relsharpen(x, y, h, alpha, p=2, M=51)
Arguments
| x | numeric vector of equally spaced x data. Missing values are not accepted. | 
| y | vector of y data. Missing values are not accepted. | 
| h | the kernel bandwidth smoothing parameter. | 
| alpha | the elasticnet mixing parameter vector, with alpha in [0,1]. | 
| p | the order of the polynomial regression. | 
| M | the length of the constraint points. | 
Details
Note that the predictor values are assumed to be equally spaced.
Value
numeric matrix of sharpened responses, with each column corresponding to different values of alpha
Author(s)
D.Wang
Examples
x<-seq(0,10,length=100)
g <- function(x) sin(x)
y<-g(x)+rnorm(100)
ys<-relsharpen(x, y, dpill(x,y), alpha=c(0.2,0.8), p=2, M=51)
y.lp2<-locpoly(x,ys[,1],bandwidth=dpill(x,y),degree=1,gridsize=100)
y.lp8<-locpoly(x,ys[,2],bandwidth=dpill(x,y),degree=1,gridsize=100)
y.lp<-locpoly(x,y,bandwidth=dpill(x,y),degree=1,gridsize=100)
curve(g,x,xlim=c(0,10))
lines(y.lp2,col=2)
lines(y.lp8,col=3)
lines(y.lp,col=5)
norm(as.matrix(g(x) - y.lp2$y),type="2")
norm(as.matrix(g(x) - y.lp8$y),type="2")
norm(as.matrix(g(x) - y.lp$y),type="2")
[Package sharpPen version 1.9 Index]