Lab week 10

This week we will talk about shrinkage and hyperparameter tuning.

We will use the Hitters data set from the ISLR library. It can be loaded using the following code

library(ISLR)
data("Hitters")

Remove all rows where the salary is NA and split the data into testing and training data sets.

  1. Use linear_reg() with mixture = 0 to specify a ridge regression model.
  2. Fit the model on the data and inspect the model. What do you see?
  3. Try to predict using this model. What are your output?
  4. Use {tune} to setup hyperparameter tuning to determine the right amount of regularization.
  5. Fit the best model. How does your parameter estimates look like?