Learn R Programming

EPX (version 1.0.4)

RKL: Calculate rank last

Description

The peformance measure rank last (RKL) is calculated as follows: after ranking the observations in decreasing order via phat, RKL is the rank of the last truly relevant observation. Hence, RKL can take on integer values from 1 to \(n\), where \(n\) is the total number of observations. If there are ties, the last object in the tied group determines RKL. That is, if all \(n\) objects are tied at the first rank but only one object is truly relevant, RKL will have a value of \(n\).

Usage

RKL(y, phat, ...)

Arguments

y

True (binary) response vector where 1 is the rare/relevant class.

phat

Numeric vector of estimated probabilities of relevance.

...

Further arguments passed to or from other methods.

Value

Numeric value of RKL.

Examples

Run this code
# NOT RUN {
## without ties in phat
# }
# NOT RUN {
resp <- c(rep(1, 50), rep(0, 50))
prob <- (1:100)*0.01
RKL(y = resp, phat = prob) # expect 100

resp <- c(rep(0, 50), rep(1, 50))
RKL(y = resp, phat = prob) # expect 50

## with ties in phat
resp <- sample(c(1, 0), 100, replace = TRUE)
prob <- rep(1, 100)
RKL(y = resp, phat = prob) # expect 100
# }

Run the code above in your browser using DataLab