Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. t=seq(0,10,0.01)
  2. y=sin(t)+rnorm(length(t))
  3. plot(t,y,cex=0.1)
  4.  
  5. # puts a loess smoother through the points
  6. lines(loess.smooth(t,y),col=2)
  7.  
  8. library(mgcv)
  9. # puts a spline through the points - read Simon Woods work to learn more about this
  10. g<-gam(y~s(t),data=data.frame(t=t,y=y))
  11. lines(t,g$fitted.values,col=3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement