auc.model: Area under curve (AUC)

View source: R/02_BIVARIATE_ANALYSIS.R

auc.modelR Documentation

Area under curve (AUC)

Description

auc.model calculates area under curve (AUC) for a given predicted values and observed target variable.

Usage

auc.model(predictions, observed)

Arguments

predictions

Model predictions.

observed

Observed values of target variable.

Value

The command auc.model returns value of AUC.

See Also

bivariate for automatic bivariate analysis.

Examples

suppressMessages(library(PDtoolkit))
data(gcd)
#categorize numeric risk factor
gcd$maturity.bin <- ndr.bin(x = gcd$maturity, y = gcd$qual, y.type = "bina")[[2]]
#estimate simple logistic regression model
lr <- glm(qual ~ maturity.bin, family = "binomial", data = gcd)
#calculate auc
auc.model(predictions = predict(lr, type = "response", newdata = gcd),
    observed = gcd$qual)

andrija-djurovic/PDtoolkit documentation built on Jan. 29, 2024, 9:35 a.m.