#ksmooth(x,y,kernel=c("box","normal"),bandwidth=0.5, #range.x=range(x), #n.points=max(100,length(x))) par(mfrow = c(2,1)) eps<-rnorm(100,0,1/3) x<-runif(100) sin4 <- function(x){sin(4*x)} y<-sin4(x)+eps plot(sin4,0,1,type="l",ylim=c(-1.0,1.5),xlim=c(0,1)) points(x,y) lines(ksmooth(x,y,"box",bandwidth=.2),col="blue") lines(ksmooth(x,y,"normal",bandwidth=.2),col="green") plot(sin4,0,1,type="l",ylim=c(-1.0,1.5),xlim=c(0,1)) lines(ksmooth(x,y,"normal",bandwidth=.2),col="green") lines(ksmooth(x,y,"normal",bandwidth=0.4),col="blue") lines(ksmooth(x,y,"normal",bandwidth=0.6),col="red")