tryTree | R Documentation |
Predict with a Tree
tryTree(mod, testSet, truth, printOut = TRUE)
mod |
A tree model constructed by package |
testSet |
The test set (a data frame). |
truth |
Correct values of the response variable. |
printOut |
If TRUE, provide a printout to the console. |
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).
For more details on use, consult http://statistics.rainandrhino.org/tigerTree/divideTrainTest.html
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.