youden: Youden

Usage Arguments Examples

View source: R/youden.r

Usage

1
youden(reference1, classification)

Arguments

reference1
classification

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (reference1, classification) 
{
    reference1[is.na(classification)] <- NA
    array1 <- sort(classification)[1:(length(classification) - 
        1)]
    sens1 <- array1
    spec1 <- array1
    youden1 <- array1
    for (i in 1:(length(array1))) {
        table1 <- prop.table(table(reference1, classification > 
            array1[i]), margin = 1)
        sens1[i] <- table1[2, 2]
        spec1[i] <- table1[1, 1]
        youden1[i] <- ifelse(sens1[i] < 0.6 | spec1[i] < 0.6, 
            0, sens1[i] + spec1[i] - 1)
    }
    cutoff1 <- array1[which.max(youden1)]
    diagt(reference1, classification > cutoff1)
    cat("cutoff point :", cutoff1, "\n")
    return(cbind(array1, sens1, spec1, youden1))
  }

gvdovandzung/thongke documentation built on May 23, 2020, 12:35 a.m.