daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. independentvar2 <- independentvar^2
  2.     regression <- lm(dependentvar ~ independentvar + independentvar2)
  3.     summary (regression)
  4.     plot (independentvar, dependentvar)
  5.     abline (regression)
  6.    
  7. plot(speed ~ dist, data = cars)
  8. fit1 = lm(speed ~ dist, cars) #fits a linear model
  9. plot(speed ~ dist, data = cars)
  10. abline(fit1) #puts line on plot
  11. fit2 = lm(speed ~ I(dist^2) + dist, cars) #fits a model with a quadratic term
  12. fit2line = predict(fit2, data.frame(dist = -10:130))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top