[R] FW: Kernel smoothing with bandwidth which varies with x

IOANNA ii54250 at msn.com
Thu May 23 18:10:58 CEST 2013


Hello all, 

I would like to use the Nadaraya-Watson estimator assuming a Gaussian
kernel: So far I sued the 
library(sm)
library(sm)
x<-runif(5000)
y<-rnorm(5000)
plot(x,y,col='black')
h1<-h.select(x,y,method='aicc')
lines(ksmooth(x,y,bandwidth=h1))

which works fine. What if my data were clustered requiring a bandwidth that
varies with x? How can I do that?

Thanks in advance, 
Ioanna



More information about the R-help mailing list