Create a regression tree using the accompanying data set (predictor variables: x 1 to x 4 ;

Question:

Create a regression tree using the accompanying data set (predictor variables: x1 to x4; target: y).

a. Use the rpart function to build a default regression tree. Display the tree using the prp function. How many leaf nodes are in the default regression tree?

b. What are the predictor variable and split value for the first split (root node) of the default regression tree? What are the rules that can be derived from the root node?

c. Use the rpart function to build a fully grown regression tree. Display the cp table. Which tree has the lowest cross-validation error? Which cp value is associated with the minimum error tree?

d. Is there a simpler tree with a cross-validation error that is within one standard error of the minimum error? If there is, then which cp value is associated with the best-pruned tree?

e. Use the prune function to prune the full tree to the best-pruned tree or the minimum error tree if the answer to part d is “No.” Display the pruned tree using the prp function. What are the ME, RMSE, MAE, MPE, and MAPE measures of the pruned tree on the validation data?

For Analytic Solver, partition data sets into training, 30% validation, and 20% and use 12345 as the default random seed. For R, partition data sets into 70% and 30% validation. Use the statement set.seed(1) to specify the random seed of 1 for both data partitioning and cross-validation.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Business Analytics Communicating With Numbers

ISBN: 9781260785005

1st Edition

Authors: Sanjiv Jaggia, Alison Kelly, Kevin Lertwachara, Leida Chen

Question Posted: