Hi, I have a dataset (see attached) with 2 variables "Y" is binary, "x" is a continuous variable. I want to calculate area under the curve (AUC) for the ROC curve, but I got different AUC values using ROC() from Epi package vs. rcorr.cens() from rms package:
test<-read.table("test.txt",sep='\t',header=T,row.names=NULL) y<-test$y x<-test$x library(Epi) ROC(form=y~x,plot="ROC") library(rms) rcorr.cens(x,y) lrm(y~x) As you can see, ROC() gave an AUC 0.782, while both rcorr.cens() and lrm() (C-index) gave AUC 0.813. That's a big difference. And I believe rms package gave me correct answer. But anyone have any clue about the difference? Thanks John
y x 0 -4.93302239136569 0 -1.86090316224316 0 -1.90248869255672 0 -1.90248869255672 0 -1.90248869255672 0 -1.90248869255672 0 -1.86090316224316 0 -4.54372324899329 0 -0.070980902884954 0 -3.10151460169392 0 -3.14310013200748 0 -1.7008914847081 0 -3.53239927437987 0 -3.10151460169392 0 -3.10151460169392 0 -3.10151460169392 0 -4.93302239136569 0 -1.86090316224316 1 -0.070980902884954 0 -2.29178783492911 0 -0.070980902884954 0 -0.070980902884954 0 -3.10151460169392 0 -3.10151460169392 0 -1.86090316224316 0 -3.10151460169392 1 -1.31159234233571 1 -0.070980902884954 0 -1.47160401987077 0 -1.47160401987077 0 -3.69241095191493 0 -1.90248869255672 0 -3.30311180954254 0 -2.71221545932153 0 -1.86090316224316 0 -2.71221545932153 0 -0.070980902884954 0 -3.10151460169392 1 -0.070980902884954 1 -0.070980902884954 0 -4.93302239136569 0 -3.10151460169392 0 -3.10151460169392 1 -1.86090316224316 0 -4.93302239136569 0 -3.10151460169392 1 -3.10151460169392 0 -3.10151460169392 0 -1.90248869255672 0 -1.86090316224316 0 -0.070980902884954 1 -0.070980902884954 0 -3.10151460169392 0 -3.10151460169392 0 -0.070980902884954 0 -3.10151460169392 0 -3.14310013200748 0 -0.070980902884954 0 -2.71221545932153 0 -1.86090316224316 0 -1.86090316224316 0 -3.14310013200748 0 -1.86090316224316 0 -3.10151460169392 0 -3.10151460169392 0 -4.93302239136569 0 -0.070980902884954 0 -4.93302239136569 0 -1.47160401987077 0 -1.86090316224316 0 -4.93302239136569 0 -4.93302239136569 0 -2.71221545932153 0 -2.71221545932153 0 -4.93302239136569 0 -3.69241095191493 0 -1.86090316224316 0 -1.90248869255672 0 -3.10151460169392 0 -3.10151460169392 0 -3.10151460169392 1 -0.070980902884954 0 -3.69241095191493 0 -3.10151460169392 1 -0.070980902884954 0 -4.54372324899329 0 -1.86090316224316 0 -1.86090316224316 0 -2.71221545932153 0 -0.070980902884954 0 -4.93302239136569 0 -0.070980902884954 0 -1.86090316224316 0 -3.10151460169392 0 -3.14310013200748 0 -4.54372324899329 0 -0.070980902884954 0 -2.71221545932153 0 -3.10151460169392 0 -3.10151460169392 0 -3.10151460169392 0 -4.93302239136569 0 -4.93302239136569 0 -1.86090316224316 0 -3.10151460169392 0 -4.93302239136569 0 -3.69241095191493 0 -3.10151460169392 0 -1.47160401987077 0 -1.86090316224316 1 -0.070980902884954 0 -3.10151460169392 0 -4.54372324899329 0 -2.71221545932153 0 -3.30311180954254 0 -1.86090316224316 0 -3.10151460169392 0 -3.10151460169392 1 -0.070980902884954 0 -1.90248869255672 0 -3.10151460169392 0 -4.93302239136569 0 -4.93302239136569 0 -3.14310013200748 1 -0.070980902884954 0 -0.070980902884954 0 -3.10151460169392 0 -4.93302239136569 1 -0.070980902884954 1 -0.070980902884954 1 -3.69241095191493 1 -3.10151460169392 0 -4.93302239136569 0 -1.90248869255672 1 -0.070980902884954 0 -1.31159234233571 1 -0.460280045257347 0 -3.30311180954254 0 -3.30311180954254 0 -4.54372324899329 0 -3.10151460169392 0 -3.69241095191493 0 -0.070980902884954 1 -1.47160401987077 1 -3.30311180954254 0 -1.86090316224316 0 -4.93302239136569
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.