Learn R Programming

stima (version 1.2.4)

prune.rt: Pruning of a regression trunk.

Description

Determines the optimally pruned size of the regression trunk by applying the c*standard error rule to the results from the cross-validation procedure.

Usage

# S3 method for rt
prune(tree, data, c.par = NULL,...)

Value

The function returns the pruned regression trunk, and the corresponding regression trunk model. The output is an object of class rt. If the pruning rule resulted in the root node, no object is returned.

Arguments

tree

a tree of class rt, that is, a regression trunk. This is the result of stima using the option model="regtrunk". To be able to prune, it is a prerequisite that the cross-validation procedure was performed with stima.

data

the dataset that was used to create the regression trunk.

c.par

the pruning parameter (c) that will be used in the c*SE rule. In the default option, the pruning function uses the best value of c, as recommended by Dusseldorp, Conversano & Van Os (2010). This best value depends on the sample size of the included dataset.

...

additional arguments to be passed.

References

Dusseldorp, E. Conversano, C., and Van Os, B.J. (2010). Combining an additive and tree-based regression model simultaneously: STIMA. Journal of Computational and Graphical Statistics, 19(3), 514-530.

See Also

stima,summary.rt

Examples

Run this code
#Example with employee data
data(employee)
#a regression trunk with a maximum of three splits is grown
#variable used for the first split (edu) is third variable in the dataset
#twofold cross-validation is performed to save time in the example,
#tenfold cross-validation is recommended
 
emprt1<-stima(employee,3,first=3,vfold=2)
summary(emprt1)
#prune the regression trunk
emprt1_pr<-prune(emprt1,data=employee)

Run the code above in your browser using DataLab