Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Practice Of Statistics

Authors: Daren S. Starnes, Josh Tabor

6th Edition

978-1319113339

Students also viewed these Mathematics questions