treeClassPredict
Compute Predictions for a Classification Tree Model from Spotfire
Description
Computes predictions for a tree classification model from Spotfire
using the data in newdata.
This function is not intended to be called by the user.
Usage
treeClassPredict(modelObj, newdata, origPredNames, newPredNames)
Arguments
modelObj |
an object of class "arbor".
|
newdata |
a data frame to use for the predictions.
It must contain columns with names newPredNames.
|
origPredNames |
a single character string containing the predictor variables used
in modelObj.
The values must be tab delimited.
|
newPredNames |
a single character string naming the predictor variable in newdata.
This is often the same as origPredNames.
The values must be tab delimited.
|
Details
This function gets invoked when predictions for a classification tree model
are requested in Spotfire.
Value
a data frame containing the prediction probabilities and predicted class.
See Also
Examples
library(Sdatasets) # for the kyphosis data
ztree <- treeClassFit(Kyphosis ~ Age + Number + Start, data=kyphosis,
modelName="arborExample")
predNamesString <- ztree$fitSummaryTable[2, 1]
predNames <- strsplit(predNamesString, "\t", fixed=TRUE)[[1]]
kyph <- kyphosis[1:20, predNames]
ztPred <- treeClassPredict(ztree$modelObj, newdata=kyph,
predNamesString, predNamesString)