predict.Treee {LDATree}R Documentation

Predictions from a fitted Treee object

Description

Prediction of test data using a fitted Treee object

Usage

## S3 method for class 'Treee'
predict(object, newdata, type = c("response", "prob", "all", "grove"), ...)

Arguments

object

a fitted model object of class Treee, which is assumed to be the result of the Treee() function.

newdata

data frame containing the values at which predictions are required. Missing values are allowed.

type

character string denoting the type of predicted value returned. The default is to return the predicted class (type = 'response'). The predicted posterior probabilities for each class will be returned if type = 'prob'. 'all' returns a data frame with predicted classes, posterior probabilities, and the predicted node indices. If cross-validation is carried out during the LDATree fitting, 'grove' option is available and will output an ensemble result from k LDATrees where k is the number of cross-validation.

...

further arguments passed to or from other methods.

Value

The function returns different values based on the type, if

Note: for factor predictors, if it contains a level which is not used to grow the tree, it will be converted to missing and will be imputed according to the missingMethod in the fitted tree.

Examples

fit <- Treee(Species~., data = iris)
predict(fit,iris)
# output prosterior probabilities
predict(fit,iris,type = "prob")

[Package LDATree version 0.1.2 Index]