Learn R Programming

ibr (version 1.3.1)

predict.npregression: Predicted values using using local polynomials

Description

Predicted values from a local polynomials of degree less than 2. See locpoly for fast binned implementation over an equally-spaced grid of local polynomial (gaussian kernel only) Missing values are not allowed.

Usage

## S3 method for class 'npregression':
predict(object, newdata, interval=
 c("none", "confidence", "prediction"), deriv=FALSE, ...)

Arguments

Value

Produces a vector of predictions. If deriv is TRUE the value is a named list with components: yhat which contains predictions and (if relevant) deriv the first derivative of the local polynomial of degree 1.

References

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

See Also

npregression, summary.npregression, locpoly

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
grid <- seq(min(x),max(x),length=500)
res <- npregression(x,y,bandwidth=0.02,control.par=list(degree=1))
plot(x,y)
lines(grid,predict(res,grid))

Run the code above in your browser using DataLab