# load MASS library with "cats" data set that have following columns: sex,
# body weight, hart weight
library(MASS)
data(cats)
colAUC(cats[,2:3], cats[,1])
# compare with examples from roc.area function: using Data from Mason and Graham (2002).
a<- (1981:1995)
b<- c(0,0,0,1,1,1,0,1,1,0,0,0,0,1,1)
c<- c(.8, .8, 0, 1,1,.6, .4, .8, 0, 0, .2, 0, 0, 1,1)
d<- c(.928,.576, .008, .944, .832, .816, .136, .584, .032, .016, .28, .024, 0, .984, .952)
A<- data.frame(a,b,c,d)
names(A)<- c("year", "event", "p1", "p2")
if (library(verification, logical.return=TRUE)) {
roc.area(A$event, A$p1) # for model with ties
roc.area(A$event, A$p2) # for model without ties
}
wilcox.test(p2~event, data=A)
# colAUC output is the same as roc.area's A.tilda values
colAUC(A[,3:4], A$event)
# colAUC output is the same as roc.area's and wilcox.test's p values
colAUC(A[,3:4], A$event, p.val=TRUE)
# example of 3-class data
data(iris)
colAUC(iris[,-5], iris[,5])
Run the code above in your browser using DataLab