Please Answer in Rmarkdown: Use the Hitters data in the ISLR package, our objective here is to
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 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?