rsq.rpart: Plots the Approximate R-Square for the Different Splits

Description Usage Arguments Side Effects Note Examples

View source: R/rsq.rpart.R

Description

Produces 2 plots. The first plots the r-square (apparent and apparent - from cross-validation) versus the number of splits. The second plots the Relative Error(cross-validation) +/- 1-SE from cross-validation versus the number of splits.

Usage

1

Arguments

x

fitted model object of class "rpart". This is assumed to be the result of some function that produces an object with the same named components as that returned by the rpart function.

Side Effects

Two plots are produced.

Note

The labels are only appropriate for the "anova" method.

Examples

1
2
z.auto <- rpart(Mileage ~ Weight, car.test.frame)
rsq.rpart(z.auto)

Example output

Regression tree:
rpart(formula = Mileage ~ Weight, data = car.test.frame)

Variables actually used in tree construction:
[1] Weight

Root node error: 1354.6/60 = 22.576

n= 60 

        CP nsplit rel error  xerror     xstd
1 0.595349      0   1.00000 1.02634 0.175290
2 0.134528      1   0.40465 0.61116 0.112440
3 0.012828      2   0.27012 0.43008 0.083395
4 0.010000      3   0.25729 0.42755 0.083509

rpart documentation built on May 29, 2017, 3:33 p.m.