Question: Here the library can be obtained using below commands in R software library(ISLR) attach(Hitters) to omit NA values: Hitters dim(Hitters) i need answer of the
Here the library can be obtained using below commands in R software
library(ISLR)
attach(Hitters)
to omit NA values:
Hitters
dim(Hitters)
i need answer of the question below, using R software

1. Consider the Hitters dataset from the previous project. It consists of 20 variables measured on 263 major league baseball players (after removing those with missing data). Take log(Sa1ary) as response (due to skewness in Salary) and the remaining 19 variables as predictors. All data will be taken as training data. For all the models below, use leave-oneout cross-validation (LOOCV) to compute the estimated test MSE. (a) Fit a tree to the data. Summarize the results. Unless the number of terminal nodes is large, diSplay the tree graphically and explicitly describe the regions corresponding to the terminal nodes that provide a partition of the predictor Space (i.e., provide expressions for the regions R1, . . . ,RJ). Report its estimated test MSE. (b) Use LOOCV to determine whether pruning is helpful and determine the Optimal size for the pruned tree. Campare the best pruned and un-pruned trees. Report estimated test MSE for the best pruned tree. Which predictors seem to be the most important? (c) Use a bagging approach to analyze the data with B = 1000. Compute the estimated test MSE. Which predictors seem to be the most important? (d) Use a randOm forest approach to analyze the data with B = 1000 and m m p/ 3. Compute the estimated test MSE. Which predictors seem to be the most important? (e) Use a boosting approach to analyze the data with B = 1000, d = 1, and A = 0.01. Compute the estimated test MSE. Which predictors seem to be the most important? (f) Compare the results from the various methods. Which method would you recommend? How does your recommendation compare with the method you recommended in the previous project
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
