4.4 Location, Location, Location: Regression Trees for Housing Data (Recitation)
Video 1: Boston Housing Data
The slides from all videos in this recitation can be downloaded here: Regression Trees for Housing Data (PDF - 1.1MB).
Video 2: The Data
In this recitation, Iain will be using the dataset boston (CSV) to predict housing prices in Boston. Please download this dataset to follow along in this recitation. This data comes from the UCI Machine Learning Repository.
An R script file with all of the R commands used in this recitation can be downloaded here: Resource Unit4_Recitation (R).
Video 3: Geographical Predictions
Video 4: Regression Trees
In this video, Iain shows a different way to plot a CART tree by using the plot and text functions instead of the prp function. This is just another way to visualize the CART tree, and shows the tree in a slightly different way. Both are valid options for plotting your CART trees.
Video 5: Putting it all Together
Video 6: The CP Parameter
Video 7: Cross-Validation
Syntax Information: In this video, we use (0:10)*0.001 to define the cp values that we want to test in our model. Alternatively, we could replace this with the sequence function seq(0,0.01,0.001) which we learned in Unit 1. For some people, the sequence function is more intuitive, and you should use whichever syntax makes more sense to you personally.