logisticRegPredict
Compute Predictions for a Logistic Regression Model from Spotfire
Description
Computes predictions for a logistic regression model from Spotfire using the
data in newdata.
This function is not intended to be called by the user.
Usage
logisticRegPredict(modelObj, newdata, origPredNames, newPredNames)
Arguments
modelObj |
an object of class "glm" that was fit with binomial family.
|
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 logistic regression 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
zglm <- logisticRegFit(Kyphosis ~ Age + Number + Start, data=kyphosis,
modelName="glmExample", responseLevel="absent")
predNamesString <- zglm$fitSummaryTable[2, 1]
predNames <- strsplit(predNamesString, "\t", fixed=TRUE)[[1]]
kyph <- kyphosis[1:20, predNames]
zgPred <- logisticRegPredict(zglm$modelObj, newdata=kyph,
predNamesString, predNamesString)