lpsmooth {bda}R Documentation

non-parametric regression

Description

To fit nonparametric regression model.

Usage

 lpsmooth(y,x, bw, sd.y,lscv=FALSE, adaptive=FALSE,
 	  from, to, gridsize,conf.level=0.95)
 npr(y,x,sd.x,bw,kernel='decon',optimal=FALSE,adaptive=FALSE,
     x0,from, to, gridsize,conf.level=0.95)
 wlpsmooth(y,x,w,s.x,bw,from,to,gridsize,conf.level=0.95)
 bootsmooth(y,x,type="relative",iter=100,conf.level=0.95)

Arguments

y, x

Two numerical vectors.

w

weights

s.x

standard deviation of the measurement error – Laplacian errors are assumed.

x0, from, to, gridsize

'x0' is the grid points where the fitted values will be evaluated. If it is missing, define a fine grid using the start point ("from"), end point ("to") and size ("gridsize").

bw

Smoothing parameter. Numeric or character value is allowed. If missing, adaptive (LSCV) bandwidth selector will be used.

kernel

kernel type: "normal","gauss","nw","decon" (default), "lp","nadaraya-watson"

lscv, adaptive

If lscv = FALSE, use the given bandwidth to fit lpr directly. If lscv = TRUE and adaptive = FALSE, compute lscv bandwidth and fit lpr. Initial bandwidth should be given. If lscv = TRUE and adaptive = TURE, compute lscv bandwidth, then compute varying smoothing parameter, then fit lpr. This algorithm could be extremeely slow when the sample size is very large.

optimal

Search for optimal bandwidth if TRUE.

sd.y

Standard deviation of y.

sd.x

Standard deviation of the measurement error x.

conf.level

Confidence level.

iter

Bootstrapping iteration number.

type

"relative" changes or "absolute" changes for effectiveness evaluation.

Value

y

Estimated values of the smooth function over a fine grid.

x

grid points where the smoothed function are evaluated.

x0, y0

cleaned data of x and y.

conf.level

confidence level of the simultaneous confidence bands.

pars

estimate parameters including smoothing bandwidth, and parameters for the tube formula.

ucb, lcb

upper and lower confidence bands.

call

function called

Examples


 x <- rnorm(100,34.5,1.5)
 e <- rnorm(100,0,2)
 y <- (x-32)^2 + e
 out <- lpsmooth(y,x)
 out
 plot(out, type='l')
 x0 <- seq(min(x),max(x),length=100)
 y0 <- (x0-32)^2
 lines(x0, y0, col=2)
 points(x, y, pch="*", col=4)


 

[Package bda version 18.2.2 Index]