group.auc.test: Function to compare AUC across all consecutive categories of...

Description Usage Arguments Value Examples

Description

This function computes commonly used classification statistics of a confusion matrix and compares the area under the curve (AUC) across all consecutive categories of an ordinal variable. The function of roc.test () from the pROC package (https://cran.r-project.org/package=pROC) is used for AUC comparison.

Usage

1
2
group.auc.test(outcome,predictor, 
                      groups, cut.off='max.Youden',BR=1)

Arguments

outcome

The outcome variable indicating the status in the form of a data frame or matrix. This variable is typically coded as 0 (positive) and 1 (negative).

predictor

A numerical vector of scores used to predict the status of the outcome. This variable should be of the same length as the outcome variable (i.e., two variables are from the same data set and also of the same number of data rows).

groups

A data frame that contains all created indicator variables using the function group.to.vars () in this package.

cut.off

Specification of the criterion used to select the optimal cut score. Three options available: (1) 'max.Youden' returns the cut score that maximizes the Youden Index (the default); (2) 'max.sen' returns the cut score that maximizes the sensitivity; and (3) 'max.spe' returns the cut score that maximizes the specificity.

BR

Base rates or known prevalence. Multiple values can be specified simultaneously. By default BR=1.

Value

A list of two objects: (1) descriptive and classification statistics, and (2) results of the AUC comparison for each pair of the consecutive categories.

Summary.Stats

Summary and classification statistics for all participants and all the consecutive groups. The first row is the results of the entire sample and has a row name of "All", followed by results for each pair of the groups specified by group.to.vars (). For example, if the first indicator of age is age.40, then the second row of results will have the row name of "age.40" and includes results for participants with age at or below 40, the third row will have the row name of "age.40.1" and includes results for those with age beyond 40.
The results include the following statistics:
* N, the sample size for each category.
* TP, true positives.
* FP, false positives.
* FN, false negatives.
* TN, true negatives.
* Cut.off, the optimal cut score.
* AUC, Area under the ROC curve.
* AUC.SE, Standard error of AUC.
* AUC.low & AUC.up, '95 * Sensitivity, also true positive rate, y-axis of the ROC.
* Specificity, also true negative rate.
* Youden.Index.
* PPV or positive predictive value for each specified base rate.
* NPV or negative predictive value for each specified base rate.
* PPV for the sample.
* NPV for the sample.
* FNR, false negative rate, or miss rate.
* FPR, false positive rate, or fall-out rate.
* FOR, false omission rate.
* FDR, false discovery rate.
* Prevalence.
* Accuracy.
* PLR, positive likelihood ratio.
* NLR, negative likelihood ratio.
* DOR, Diagnostic odds ratio.

AUC.test

Results of the AUC comparison for each pair of the consecutive categories.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
 
#read the example data
data(ROC.data.ex)
#create new binary variables for the ordinal variable
data.new.age<-group.to.vars(ROC.data.ex,
                            ROC.data.ex$age,
                           root.name='age')
#run the function
result.age<-group.auc.test(ROC.data.ex$outcome,ROC.data.ex$predictor, 
                           groups=data.new.age[,5:ncol(data.new.age)],
                           cut.off='max.Youden', BR=1)
#obtain results
result.age$Summary.Stats
result.age$AUC.test

ROCpsych documentation built on Aug. 17, 2020, 5:06 p.m.