Learn R Programming

ibr (version 1.3.1)

npregression: Local polynomials smoothing

Description

Predicted values from a local polynomials of degree less than 2. Missing values are not allowed.

Usage

npregression(x, y, criterion="rmse", bandwidth=NULL,kernel="g",
             control.par=list(), cv.options=list())

Arguments

Value

Returns an object of class npregression which is a list including:bandwidthThe kernel bandwidth smoothing parameter.residualsVector of residuals.fittedVector of fitted values.dfThe effective degree of freedom of the smoother.callA list containing four components: x contains the initial explanatory variables, y contains the initial dependant variables, criterion contains the chosen criterion, kernel the kernel and degree the chosen degreecriteriaeither a named list containing the bandwidth search grid and all the criteria (rmse and mae) evaluated on the grid gridbw. If the bandwidth bandwidth is given by the user NULL is returned

References

Wand, M. P. and Jones, M. C. (1995). Kernel Smoothing. Chapman and Hall, London.

See Also

predict.npregression, summary.npregression, locpoly, ibr

Examples

Run this code
f <- function(x){sin(5*pi*x)}
n <- 100
x <- runif(n)
z <- f(x)
sigma2 <- 0.05*var(z)
erreur <- rnorm(n,0,sqrt(sigma2))
y <- z+erreur
res <- npregression(x,y,bandwidth=0.02)
summary(res)
ord <- order(x)
plot(x,y)
lines(x[ord],predict(res)[ord])

Run the code above in your browser using DataLab