treeClassEvaluate
Evaluate a Classification Tree Model from Spotfire

Description

Evaluates a tree classification model from Spotfire by computing predictions and residuals from the supplied newdata. Summary statistics and data for visualizations of the predictions are returned. This function is not intended to be called by the user.

Usage

treeClassEvaluate(modelObj, newdata, origRespName, newRespName,
    origPredNames, newPredNames, modelName)

Arguments

modelObj an object of class "arbor".
newdata a data frame to use for the evaluations. It must contain columns with names newRespName and newPredNames.
origRespName a character string naming the response variable used in modelObj.
newRespName a character string naming the response variable in newdata. This is often the same as origRespName.
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.
modelName a character string containing the name of the model in Spotfire. This is used to construct the names of the components in the return list.

Details

This function gets invoked when a tree classification model is evaluated in Spotfire.
Value
a list with components:
evalSummaryTable a single column data frame containing summary information for the model evaluation. This includes accuracy and kappa.
evalConfusionMatrix a table containing the confusion matrix for the model predictions.
evalPlotData a data frame containing the predictions, residuals and Normal quantiles of the residuals, all computed from newdata.
evalPlotDesc a icharacter matrix containing a description of the visualizations that can be created in Spotfire using the data in evalPlotData. The columns of the matrix are:
MenuName
the text to appear in the Spotfire menu.
PlotType
the type of visualization to create
Xdatatable
the name of the data table for the x-axis variable. If the data table is generated by this function (i.e. fitPlotData) the name will have the prefix modelName_.
Xcolumn
the name of the x-axis column in Xdatatable.
Ydatatable
the name of the data table for the y-axis variable. If the data table is generated by this function (i.e. fitPlotData) the name will have the prefix modelName_.
Ycolumn
the name of the y-axis column in Ydatatable.
Title
the title for the visualization.
See Also
treeClassFit, treeClassPredict, arbor
Examples
library(Sdatasets)  # for the kyphosis data
treeClass <- treeClassFit(Kyphosis ~ Age + Number + Start, data=kyphosis,
    modelName="treeExample")
respName <- treeClass$fitSummaryTable[1,1]
predNamesString <- treeClass$fitSummaryTable[2, 1]
predNames <- strsplit(predNamesString, "\t", fixed=TRUE)[[1]]
kyph <- kyphosis[1:30, c(respName, predNames)]
treeEval <- treeClassEvaluate(treeClass$modelObj,
    newdata=kyph, respName, respName, predNamesString, predNamesString,
    modelName="treeExample")
Package SpotfireStats version 6.1.1-7
Package Index