Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts In Discrete Mathematics

Authors: Mofidul Islam

1st Edition

9353146372, 9789353146375

More Books

Students also viewed these Mathematics questions