Question: Please Answer in Rmarkdown: Use the Hitters data in the ISLR package, our objective here is to predict the salary variable as the response using

Please Answer in Rmarkdown:

Use the Hitters data in the ISLR package, our objective here is to predict the salary variable as the response using the remaining variables.

a. Split the data into a training and testing data set.

b. Fit a linear model using least squares on the training set and report the test error obtained.

c. Fit a ridge regression model on the training set, with chosen by cross-validation. Report the test error obtained.

d. Fit a lasso model on the training set, with chosen by cross validation. Report the test error obtained, along with the number of non-zero coefficients estimates.

e. Comment on the results obtained. How accurately can we predict the number of college applications received? Is there much difference among the test errors resulting from these three approaches?

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!