Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t=seq(0,10,0.01)
- y=sin(t)+rnorm(length(t))
- plot(t,y,cex=0.1)
- # puts a loess smoother through the points
- lines(loess.smooth(t,y),col=2)
- library(mgcv)
- # puts a spline through the points - read Simon Woods work to learn more about this
- g<-gam(y~s(t),data=data.frame(t=t,y=y))
- lines(t,g$fitted.values,col=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement