roc.curve: Roc curve

Description Usage Arguments Value Examples

View source: R/metrics.R

Description

Roc curve

Usage

1
roc.curve(x, y, file = "None", AUC = FALSE)

Arguments

x

a numerical vector

y

represent logical class TRUE/FALSE.

file

name of output file for saving roc curve plot.

AUC

return auc value AUC = TRUE

Value

Return roc curve values: TPR, FPR or AUC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
random.x <- sample.int(3000,1000,replace=FALSE)
class <- c(rep(TRUE, 500), rep(FALSE, 500))
 pos <- sample.int(1000, 1000)
 random.y <- class[order(pos)]

perfect.x <- 1:3000
perfect.y <- c(rep(TRUE, 1500), rep(FALSE, 1500))

worst.x <- 1:3000
worst.y <- c(rep(FALSE, 1500), rep(TRUE, 1500))

roc.curve(random.x, random.y, file= "randomRocCurve")
roc.curve(perfect.x, perfect.y, file= "perfectRocCurve")
roc.curve(worst.x, worst.y, file= "worstRocCurve") 

AnderEhu/sme documentation built on Jan. 31, 2022, 12:01 a.m.