1 | youden(reference1, classification)
|
reference1 |
|
classification |
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))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.