https://github.com/cran/GsymPoint
Tip revision: 48978493006d9009b92388f7dddf92e9ab78b98d authored by Mü¾¶¼nica Lü¾¶¼pez-Ratü¾¶¼n on 08 February 2017, 15:54:09 UTC
version 1.1
version 1.1
Tip revision: 4897849
calculate.empirical.AUC.R
calculate.empirical.AUC <-
function(data, marker, status, tag.healthy) {
marker.diseased = data[data[,status] != tag.healthy, marker]
n.diseased = length (marker.diseased)
marker.healthy = data[data[,status] == tag.healthy, marker]
n.healthy = length(marker.healthy)
marker.diseasedmat <- matrix(rep(marker.diseased,n.healthy), nrow = n.healthy, byrow = T)
marker.healthymat <- matrix(rep(marker.healthy,n.diseased), nrow = n.healthy, byrow = F)
diffmat <- marker.healthymat-marker.diseasedmat
AUC <- (length(diffmat[diffmat < 0])+0.5*length(diffmat[diffmat == 0]))/(n.diseased*n.healthy)
res <- AUC
return(res)
}