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

Description Usage Arguments Details See Also Examples

View source: R/auc_adj.r

Description

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

Usage

1
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).

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/

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.

See Also

logregr , modelvalid

Examples

1
2
3
data(log_regr_data) # load the sample dataset
model <- glm(admit ~ gre + gpa + rank, data = log_regr_data, family = "binomial") # fit a logistic regression model, storing the results into an object called 'model'
aucadj(data=log_regr_data, fit=model, B=200)

gianmarcoalberti/GmAMisc documentation built on May 3, 2019, 6:44 p.m.