Question: 1. (1.5 pts.) This question involves the Auto data set from the ISLR package. (a) Remove the variables name and origin and split the sample

 1. (1.5 pts.) This question involves the Auto data set from

1. (1.5 pts.) This question involves the Auto data set from the ISLR package. (a) Remove the variables name and origin and split the sample set into a training set and a validation set (set a seed equal to your NIU). (b) Using the training data, fit a linear regression model with mpg as the response variable. Based on the fitted model, obtain predictions for the test data and calculate the test mean squared error. Obtain the estimated coefficients. (c) Using the training data, fit a ridge regression model with mpg as the response variable, using the default sequence of lambda values and select the best value of lambda by crossvalidation. Based on the fitted model with the optimal value of lambda, obtain predictions for the test data and calculate the test mean squared error. Obtain the estimated coefficients. (d) Using the training data, fit lasso regression model with mpg as the response variable, using the default sequence of lambda values and select the best value of lambda by crossvalidation. Based on the fitted model with the optimal value of lambda, obtain predictions for the test data and calculate the test mean squared error. Obtain the estimated coefficients

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!