Linear regression finds the straight line that best fits a set of data points. Once we have that line, we can use it to make predictions.
- Simple linear regression uses one variable \(x\) to predict another variable \(y\).
- We use the built-in R dataset
mtcars:- \(x\) =
wt, the weight of a car (in 1000 lb) - \(y\) =
mpg, its fuel economy (miles per gallon)
- \(x\) =
Our question: if a car gets 1000 lb heavier, how many miles per gallon does it lose?