[R] AUC for logistic regression [was: (no subject)]

Bernardo Rangel Tura tura at centroin.com.br
Wed Dec 15 21:30:37 CET 2004


At 17:07 15/12/2004, Spencer Graves wrote:

>>Dear R-helper,
>>
>>I would like to compare the AUC of two logistic regression models (same 
>>population). Is it possible with R ?
>>
>>Thank you
>>
>>Roman Rouzier


Roman

If I understand your question You have 2 ROC curve from same dataset. In 
this case you can use a routine create for me :

seROC<-function(AUC,na,nn){
a<-AUC
q1<-a/(2-a)
q2<-(2*a^2)/(1+a)
se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
se
}


cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
se1<-seROC(AUC1,na1,nn1)
se2<-seROC(AUC2,na2,nn2)
sed<-sqrt(se1^2+se2^2-2*r*se1*se2)
zad<-(AUC1-AUC2)/sed
p<-dnorm(zad)
a<-list(zad,p)
a
}

The first function (seROC) calculate teh standart error of ROC curve, the 
second function (cROC) compare ROC curves .

The parameters:

AUC - area under curve
na - number of positives results
nn - number total tests (positives +negatives)
r - correlation of two numeric variables

Best wishes





Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.




More information about the R-help mailing list