cal_confus: Calculate confusion matrices

Description Usage Arguments Details Value References Examples

View source: R/cal_confus.R

Description

This function calculates the confusion matrices across different cutoff points.

Usage

1
cal_confus(true_vec, pred_vec, force_diag=TRUE)

Arguments

true_vec

A binary vector of real labels

pred_vec

A continuous predicted score(probabilities) vector, must be the same length with true_vec

force_diag

If TRUE, TPR and FPR will be forced to across (0, 0) and (1, 1)

Details

This function calculates the TP, FP, FN, TN, TPR, FPR and PPV across different cutoff points of pred_vec. TPR and FPR are forced to across (0, 0) and (1, 1) if force_diag=TRUE.

Value

TP

True positive

FP

False positive

FN

False negative

TN

True negative

TPR

True positive rate

FPR

False positive rate

PPV

Positive predictive value

References

https://en.wikipedia.org/wiki/Confusion_matrix

Examples

1
2
3
4
data(test_data)
true_vec <- test_data[, 1]
pred_vec <- test_data[, 5]
confus_res <- cal_confus(true_vec, pred_vec)

Example output



multiROC documentation built on May 1, 2019, 10:11 p.m.