perf.auc: Check GLM or survival model performance based on AUC

Description Usage Arguments Value Examples

Description

perf.auc checks model performance for a given model object, using the training and test dataset.

Usage

1
perf.auc(model, train, test)

Arguments

model

The GLM or survival model (coxph) object.

train

The training dataset

test

The test dataset

Value

For a GLM model, it returns the ROC curve and the AUC values for the training and test datasets respectively. For a survival model, it returns the time-dependent AUC at each time step and the integrated AUC value (iAUC)

Examples

1
2
3
4
5
6
7
8
9
data <- rpart::stagec
data <- data[sample(nrow(data), 10000, replace = TRUE), ]
data <- na.omit(data)

ind.train <- caret::createDataPartition(data$pgstat, p = .7, list = FALSE)
dt.train <- data[ind.train, ]
dt.test <- data[-ind.train, ]
mod <- glm(pgstat ~ ., dt.train, family=binomial(link='logit'))
perf.auc(mod, dt.train, dt.test)

JianhuaHuang/streamlineR documentation built on May 7, 2019, 10:40 a.m.