We use the built-in mtcars dataset in R.
- Response variable: mpg (miles per gallon)
- Predictor variable: wt (weight of the car)
This dataset contains information on 32 cars.
head(mtcars[, c("mpg", "wt", "hp", "fitted", "residuals")])
## mpg wt hp fitted residuals
## Mazda RX4 21.0 2.620 110 23.28261 -2.2826106
## Mazda RX4 Wag 21.0 2.875 110 21.91977 -0.9197704
## Datsun 710 22.8 2.320 93 24.88595 -2.0859521
## Hornet 4 Drive 21.4 3.215 110 20.10265 1.2973499
## Hornet Sportabout 18.7 3.440 175 18.90014 -0.2001440
## Valiant 18.1 3.460 105 18.79325 -0.6932545