Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with the following exercise on R studio 1. (1.5 pts.) This question involves the Auto data set from the ISLR package. (a)

I need help with the following exercise on R studio

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

Advanced Calculus

Authors: R Creighton Buck

3rd Edition

147861613X, 9781478616139

More Books

Students also viewed these Mathematics questions

Question

What are the key elements of IoT embedded system?

Answered: 1 week ago

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago