Appex 06
STA 112 - Fall 2023
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-f23/appex-06.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