# ROC.stats: Function to compute statistics from a confusion matrix In ROCpsych: Compute and Compare Diagnostic Test Statistics Across Groups

## Description

This function computes all diagnostic statistics from a confusion matrix.

## Usage

 `1` ```ROC.stats(outcome, predictor,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). `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

An object that contains the results.

 `ROC.stats` Summary and classification statistics for all participants and all the consecutive groups. Specifically. * N, 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, the 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.

## Examples

 ```1 2 3 4 5 6``` ``` #read the example data data(ROC.data.ex) #run the function ROC.stats(ROC.data.ex\$outcome, ROC.data.ex\$predictor, cut.off='max.Youden',BR=1) ```

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