logisticRegFit
Fit a Logistic Regression Model from Spotfire

Description

Fits a logistic regression model from Spotfire using the formula, data, and (optionally) the weights. Summary statistics, the model coefficients and data for visualizations of the fit are returned. This function is not intended to be called by the user.

Usage

logisticRegFit(formula, data, weights, modelName = NULL, responseLevel,
    epsilon, maxit)

Arguments

formula a formula object. The response variable, specified as either a single numeric variable must be on the left of a tilde (~) operator and the terms, separated by plus sign (+) operators, must be on the right.
data data frame to contain the variables named in the formula.
weights a character string containing the name of the observation weights column in data.
modelName a character string containing the name of the model in Spotfire.
responseLevel a character string containing the level in the response variable that is being modeled.
epsilon a numeric value, convergence threshold. When abs(new.deviance-old.deviance)/(old.deviance + epsilon) < epsilon the algorithm is assumed to have converged.
maxit maximum number of iterations

Details

This function gets invoked when a logistic regression model is fit in Spotfire from the Tools menu.
Value
a list with components:
modelObj the object created by calling glm with the binomial family using the formula and data. The object is converted to a "raw" binary object with the function SObjectToBlob from the SpotfireUtils package. This is to allow storing the object in Spotfire. To convert to the original glm object, use the BlobToSObject function, also in the SpotfireUtils package.
coefTable a data frame containing the model coefficients, standard errors, z-statistics and p-values.
fitSummaryTable a single column data frame containing a summary of the linear model. The first row of the data frame contains the name of the response column in data. The second row contains the names of the predictor columns from data in a single string, comma separated.
fitPlotData a data frame containing the fitted values, residuals, standardized residuals, Normal quantiles of the standardized residuals, square root of the absolute value of the standardized residuals, and Cooks distance values.
fitPlotDesc a character matrix containing a description of the visualizations that can be created in Spotfire using the data in fitPlotData. 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.
varImpTable a two column data frame with columns Variable and VarImportance. The value of VarImportance is the absolute value of the z-statistic from the coefficients table from the model summary.
See Also
logisticRegEvaluate, logisticRegPredict, glm, binomial
Examples
library(Sdatasets)  # for the kyphosis data
logreg01 <- logisticRegFit(Kyphosis ~ Age + Number + Start, data=kyphosis,
    modelName="logisticExample", responseLevel="absent")
names(logreg01)
logreg01[[2]]
Package SpotfireStats version 6.0.0-69
Package Index