Question: Please help with this regression tree question using R The MASS library in R contains the Boston dataset, which records crim (per capita crime rate
Please help with this regression tree question using R

The MASS library in R contains the Boston dataset, which records crim (per capita crime rate by town) for 506 neighborhoods around Boston. We will seek to predict crim using 13 predictors in the data set. Note that the predictor rad should be considered as a categorical variable, which is the index of accessibility to radial highways with nine possible values (1 to 8 and 24). To load in the Boston data set, use \"library(MASS)\". To nd out more about the data set, type \"?Boston\". (a) (b) (C) Fit a regression tree to the whole dataset by treating the predictor rad as a continuous variable. i. How many terminal nodes are there in the tted tree? ii. Which variables are used in the tree construction? iii. What is the MSE of this tted tree? iv. Provide the plot of this tted tree. Fit a regression tree to the Whole dataset by treating the predictor rad as a categorical variable. Is the tted tree in (b) difference from the tted tree in (a)? Apply the cv.tree() function to the regression tree in (a) in order to determine the optimal tree size. Before running the cv.tree() function, set the seed at l with statement set.seed(1). i. Produce a plot with tree size on the x-axis and cross-validated MSE on the y-axis. ii. What is the optimal tree size? iii. Produce a pruned tree corresponding to the optimal tree size. iv. Compare the MSE between the pruned and unpruned trees. Which is higher
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
