Learn R Programming

bda (version 3.1.3-2)

npr: non-parametric regression

Description

To fit nonparametric regression model.

Usage

npr(y,x, bw, from, to, gridsize)

Arguments

y,x
Two numerical vectors.
from,to,gridsize
start point, end point and size of a fine grid where the EDF will be evaluated.
bw
Smoothing parameter. Numeric or character value is allowed. If missing, adaptive (LSCV) bandwidth selector will be used.

Examples

Run this code
x <- rnorm(100,34.5,1.5)
 e <- rnorm(100,0,2)
 y <- (x-32)^2 + e
 out <- npr(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)

Run the code above in your browser using DataLab