SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- independentvar2 <- independentvar^2
- regression <- lm(dependentvar ~ independentvar + independentvar2)
- summary (regression)
- plot (independentvar, dependentvar)
- abline (regression)
- plot(speed ~ dist, data = cars)
- fit1 = lm(speed ~ dist, cars) #fits a linear model
- plot(speed ~ dist, data = cars)
- abline(fit1) #puts line on plot
- fit2 = lm(speed ~ I(dist^2) + dist, cars) #fits a model with a quadratic term
- 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.