Appex 07
STA 112 - Spring 2024
Part 1
- Go to lucy.shinyapps.io/least-squares/
- This shows a scatter plot of 10 data points with a line estimating the relationship between
x
andy
. Drag the blue points to change the line. - See if you can find a line that minimizes the sum of square errors
Part 2
- Create a new project from this template in RStudio Pro:
https://github.com/sta-112-s24/appex-07.git
- Load the packages and data by running the top chunk of R code
- Learn about the
PorschePrice
data by running?PorschePrice
in your Console - Fit a linear model predicting
Price
fromMileage
- Add a variable called
y_hat
to thePorschePrice
dataset with the predicted y values - Add a variable called
residual
to thePorschePrice
dataset with the residuals