Guest User

Untitled

a guest
Jan 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. dat = read.csv('https://gist.githubusercontent.com/geotheory/10ad6b2051e69213f81ccf2366938cda/raw/485c98381579d74ec581e34c1ebfa80b66b76d69/poly-test.csv')
  2.  
  3. # polynomial model
  4. pm = lm(vy ~ poly(vx, degree=20, raw=TRUE), data = dat)
  5.  
  6. newdat = data.frame(vx = 10^seq(4,6,.02))
  7. newdat$vy = predict(pm, newdata = newdat)
  8. #> Warning in predict.lm(pm, newdata = newdat): prediction from a rank-
  9. #> deficient fit may be misleading
  10.  
  11. plot(dat, log='x', pch=16, cex=.6)
  12. lines(newdat, col='red', lwd=3)
Add Comment
Please, Sign In to add comment