e_rnorm(200) x_runif(200) y_sin(2+pi*(1-x)*2)+x*e plot(x,y) lines(loess.smooth(x,y),lty=1,col=3) lines(ksmooth(x,y),lty=2,col=4) lines(smooth.spline(x,y),lty=3,col=5) legend(0,2,c("locally weighted","kernal smooth","spline smooth"),lty=1:3,col=3:5)