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