npregress {ibr} | R Documentation |
Local polynomials smoothing
Description
Predicted values from a local polynomials of degree less than 2.
Missing values are not allowed.
Usage
npregress(x, y, criterion="rmse", bandwidth=NULL,kernel="g",
control.par=list(), cv.options=list())
Arguments
x |
A numeric vector of explanatory variable of length n. |
y |
A numeric vector of variable to be explained of length n. |
criterion |
Character string. If the bandwidth
( |
bandwidth |
The kernel bandwidth smoothing parameter (a numeric vector of either length 1). |
kernel |
Character string which allows to choose between gaussian kernel
( |
control.par |
A named list that control optional parameters. The
two components are |
cv.options |
A named list which controls the way to do cross
validation with component |
Value
Returns an object of class npregress
which is a list including:
bandwidth |
The kernel bandwidth smoothing parameter. |
residuals |
Vector of residuals. |
fitted |
Vector of fitted values. |
df |
The effective degree of freedom of the smoother. |
call |
A list containing four components: |
criteria |
either a named list containing the bandwidth search
grid and all the criteria ( |
Note
See locpoly
for fast binned implementation
over an equally-spaced grid of local polynomial. See ibr
for univariate and multivariate smoothing.
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
predict.npregress
,
summary.npregress
,
locpoly
, ibr
Examples
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 <- npregress(x,y,bandwidth=0.02)
summary(res)
ord <- order(x)
plot(x,y)
lines(x[ord],predict(res)[ord])