tryTree: Predict with a Tree

Description Usage Arguments Value Note Examples

Description

Predict with a Tree

Usage

1
tryTree(mod, testSet, truth, printOut = TRUE)

Arguments

mod

A tree model constructed by package tree.

testSet

The test set (a data frame).

truth

Correct values of the response variable.

printOut

If TRUE, provide a printout to the console.

Value

A list containing: deviance and residMeanDev (residual mean deviance). If mod is a classification tree, then the list also contains error.rate, misclass (number of misclassifications at terminal nodes), and confusion (the confusion matrix).

Note

For more details on use, consult http://statistics.rainandrhino.org/tigerTree/divideTrainTest.html

Examples

1
2
3
4
5
6
dfs <- divideTrainTest(seed = 3030, prop.train = 0.67, data = iris)
irisTrain <- dfs$train
irisTest <- dfs$test
tr.mod <- tree(Species ~ ., data = irisTrain)
summary(tr.mod)
tryTree(mod = tr.mod, testSet = irisTest, truth = irisTest$Species)

homerhanumat/tigerTree documentation built on May 17, 2019, 4:51 p.m.