predict.npregress: Predicted values using using local polynomials

Description Usage Arguments Value Author(s) References See Also Examples

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

1
2
3
## S3 method for class 'npregress'
predict(object, newdata, interval=
 c("none", "confidence", "prediction"), deriv=FALSE, ...)

Arguments

object

Object of class npregress.

newdata

An optional vector of values to be predicted. If omitted, the fitted values are used.

interval

Type of interval calculation. Only none is currently avalaible.

deriv

Bolean. If TRUE it returns the first derivative of the local polynomial (of degree1).

...

Further arguments passed to or from other methods.

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.

Author(s)

Pierre-Andre Cornillon, Nicolas Hengartner and Eric Matzner-Lober.

References

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

See Also

npregress, summary.npregress, locpoly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 <- npregress(x,y,bandwidth=0.02,control.par=list(degree=1))
plot(x,y)
lines(grid,predict(res,grid))

Example output

Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-20. For overview type 'help("mgcv-package")'.

ibr documentation built on May 2, 2019, 8:22 a.m.