tree.demo: Interactively demonstrate regression trees
Description
Interactively recursively partition a dataset to demonstrate
regression trees.
Usage
tree.demo(x, y)
Arguments
x
The predictor variable.
y
The response variable.
Value
A vector with the x-values of the cut points that you selected (sorted).
Details
This function first creates a scatterplot of x and y and
shows the residual sum of squares from fitting a horizontal line to
the y-values.
Clicking anywhere on the graph will show an updated graph where the
data is partitioned into 2 groups based on the x-value where you
clicked with a horizontal line fit to each group (including showing
the updated residual sum of squares). Clicking again will move the
partitioning value based on the new click.
When you have found a good partitioning (reduces the RSS), right click
and choose 'stop' and that partition will become fixed. Now you can
click to do a second set of partions (breaking the data into 3
groups).
To finish the demo, right click and choose 'stop', then right click
again and choose 'stop' again.