GmAMisc (version 1.1.1)

aucadj: R function for optimism-adjusted AUC (internal validation)

Description

The function allows to calculate the AUC of a (binary) Logistic Regression model, adjusted for optimism.

Usage

aucadj(data, fit, B)

Arguments

data

Dataframe containing the dataset (note: the Dependent Variable must be stored in the first column to the left).

fit

Object returned from glm() function.

B

Desired number of bootstrap resamples (suggested values: 100 or 200).

Value

The returned boxplots represent: -the distribution of the AUC value in the bootstrap sample (auc.boot), which represents "an estimation of the apparent performance" (according to the aforementioned reference); -the distribution of the AUC value deriving from the model fitted to the bootstrap samples and evaluated on the original sample (auc.orig), which represents the model performance on independent data. At the bottom of the chart, the apparent AUC (i.e., the value deriving from the model fitted to the original dataset) and the AUC adjusted for optimism are reported.

Details

The function performs an internal validation of a model via a bootstrap procedure (devised by Harrell and colleagues), which enables to estimate the degree of optimism of a fitted model and the extent to which the model will be able to generalize outside the training dataset. If you want more info, you can refer to this website (http://thestatsgeek.com/2014/10/04/adjusting-for-optimismoverfitting-in-measures-of-predictive-ability-using-bootstrapping/), and/or read the following interesting article (in which the bootstrap procedure is described at page 776): http://thestatsgeek.com/2014/10/04/adjusting-for-optimismoverfitting-in-measures-of-predictive-ability-using-bootstrapping/

See Also

logregr , modelvalid

Examples

Run this code
# NOT RUN {
# load the sample dataset
data(log_regr_data)

# fit a logistic regression model, storing the results into an object called 'model'
model <- glm(admit ~ gre + gpa + rank, data = log_regr_data, family = "binomial")

aucadj(data=log_regr_data, fit=model, B=200)

# }

Run the code above in your browser using DataCamp Workspace