Assignment 7
Assignment 7
1. In the lab, a classification tree was applied to the Carseats data set after
converting Sales into a qualitative response variable. Now we will seek to predict
Sales using regression trees and related approaches, treating the response as a
quantitative variable.
(a) Split the data set into a training set and a test set.
(b) Fit a regression tree to the training set. Plot the tree, and interpret the results.
What test MSE do you obtain?
(c) Use cross-validation in order to determine the optimal level of tree complexity.
Does pruning the tree improve the test MSE?
(d) Use the bagging approach in order to analyze this data. What test MSE do you
obtain? Use the importance() function to determine which variables are most
important.
e) Use random forests to analyze this data. What test MSE do you obtain? Use the
importance() function to determine which variables are most important.