get.auroc: get.auroc

View source: R/ranger_RF_util.R

get.aurocR Documentation

get.auroc

Description

calculates the area under the ROC curve

Usage

get.auroc(predictor, y, positive_class)

Arguments

predictor

A predictor. For example, one column in the probability table, indicating the probability of a given observation being the positive class in the factor y.

y

A binary factor vector indicates observed values.

positive_class

A class of the factor y.

Value

The auroc value.

Author(s)

Shi Huang

Examples

y<-factor(c(rep("A", 31), rep("B", 29)))
y1<-factor(c(rep("A", 18), rep("B", 20), rep("C", 22)))
y0<-factor(rep("A", 60))
pred <- c(runif(30, 0.5, 0.9), runif(30, 0, 0.6))
prob <-data.frame(A=pred, B=1-pred)
positive_class="A"
get.auroc(predictor=prob[, positive_class], y, positive_class="A")
get.auroc(predictor=prob[, positive_class], y, positive_class="B")
get.auroc(predictor=prob[, positive_class], y0, positive_class="A")
get.auroc(predictor=prob[, positive_class], y1, positive_class="A")

shihuang047/crossRanger documentation built on Feb. 7, 2023, 10:03 p.m.