performance.glm: Model Performance for Logistic Regression

View source: R/performance.glm.R

performance.glmR Documentation

Model Performance for Logistic Regression

Description

Produce indices of model performance for logistic regression

Usage

## S3 method for class 'glm'
performance(x, data, digits = 4, p = 0.5, plot = TRUE, ...)

Arguments

x

an object of class "glm".

data

a data frame. If no data frame is provided, the model training data is used.

digits

integer; number of digits to print (default=4).

p

numeric; probability cutoff for classifying cases (default = 0.5)

plot

logical; If TRUE the results are plotted.

...

not currently used

Details

The model in the glm object is used to predict the the predicted probability of being a "positive" case for each observation in the data frame. If a data frame is not specified, the model is applied to the training data (data frame contained in the model component of the glm object). If the predicted probability is greater then p, the case is classified as "positive", "not positive" otherwise. The actual and predicted classifications are compared to calculate performance metrics.

The function returns general information about the model, a confusion matrix and statistics generated by the confusionMatrix function from the caret package, and a graph visualizing the results.

Value

The results of the methods performance.glm

See Also

confusionMatrix, roc_plot, lift_plot.

Examples

# performance on training sample
fit <- regress(caesarian ~ ., data = caesarian)
performance(fit, plot=TRUE)

Rkabacoff/qacReg documentation built on Aug. 1, 2022, 11:11 p.m.