Intro to non-parametric regressions.

require(ggplot2)
require(data.table)
require(reshape2)
X = runif(1000);
Y = 10*((X-0.5)^3 -  0.1*X) + 0.2*rnorm(1000)
data = data.table(x=X,y=Y,yt=10*((X-0.5)^3 -  0.1*X))

ggplot(data,aes(x=x,y=y)) + geom_point() + geom_line(aes(y=yt),color="red",size=2) +theme_bw()