Re: [R] ROCR for combination of markers

From: Rasanga Ruwanthi <ruwanthi_kdr_at_yahoo.com>
Date: Thu, 28 Apr 2011 14:07:12 -0700 (PDT)


Thanks Eik. As you said both packages give the same result, except labelling of the x axis.

From: Eik Vettorazzi <E.Vettorazzi_at_uke.uni-hamburg.de> Subject: Re: [R] ROCR for combination of markers To: "Rasanga Ruwanthi" <ruwanthi_kdr_at_yahoo.com> Cc: "R Help" <r-help_at_r-project.org>
Date: Thursday, 28 April, 2011, 20:08

Hi Rasanga,
I think there is nothing wrong with that plot (you may compare both curves obtained by ROC from Epi and plot.roc from pROC). As usual, both functions plot (1-specificity) at the x-coordinate against sensitivity on y. Perhaps a bit confusing is the labelling of the latter function, it has 'specificity' on x, but the ticks go (in reading direction) from 100% down to 0% so it is correct - look at the documentation or the source code of that function to fix it to your needs. Anyway - the AUC is (up to changes in sign) invariant to interchanging spec and sens or reversing the values and so is the CI for AUC.

cheers.

Am 28.04.2011 19:54, schrieb Rasanga Ruwanthi:

> Hi Eik


> It seems plot.roc function below plots sensitivity vs specificity, but
> not (1-sensitivity) vs specificity. As you said it gives CIs of AUC, but
> is there a way to get it for  (1-sensitivity) vs specificity?


> Thanks
> Rasanga


> 
> 
> --- On *Thu, 28/4/11, Eik Vettorazzi
> /<E.Vettorazzi_at_uke.uni-hamburg.de>/* wrote:
> 
> 

>     From: Eik Vettorazzi <E.Vettorazzi_at_uke.uni-hamburg.de>
>     Subject: Re: [R] ROCR for combination of markers
>     To: "Rasanga Ruwanthi" <ruwanthi_kdr_at_yahoo.com>
>     Cc: "r-help" <r-help@r-project.org>
>     Date: Thursday, 28 April, 2011, 17:36
> 

>     Hi,
>     today I accidentally stumbled on a new? package named 'pROC', which
>     might do the job
> 

>     library(pROC)
> 

>     out=ROC( form = y1 ~ x + z, plot="ROC")
> 

>     #calculate the underlying glm from ROC
>     prd<-predict(glm(y1 ~ x + z,family="binomial"),type="response")
> 

>     #or use the results from ROC
>     prd<-out$res$lr.eta[-1]
> 

>     rocobj <- plot.roc(y1, prd,
>                     main="Confidence intervals", percent=TRUE,
>                     ci=TRUE, # compute AUC (of AUC by default)
>                     print.auc=TRUE) # print the AUC (will contain the CI)
>     ciobj <- ci.se(rocobj, # CI of sensitivity
>                    specificities=seq(0, 100, 5)) # over a select set of
>     specificities
>     plot(ciobj, type="shape", col="#1c61b6AA") # plot as a blue shape
> 

>     cheers
> 
> 

>     Am 28.04.2011 17:15, schrieb Rasanga Ruwanthi:
>     > Many thanks Eik. That was really helpful. I have found ROC
>     function Epi
>     > package draws ROC curve for a combination of markers. What I tried was
>     >
>     > library(Epi)
>     > x <- rnorm( 100 )
>     > z <- rnorm( 100 )
>     > w <- rnorm( 100 )
>     > tigol <- function( x ) 1 - ( 1 + exp( x ) )^(-1)
>     > y1 <- rbinom( 100, 1, tigol( 0.3 + 3*x + 5*z + 7*w ) )
>     > out=ROC( form = y1 ~ x + z, plot="ROC",MI=FALSE)
>     >
>     > But this function does not produce SE or CI of the AUC or any other
>     > statistics. Any suggestion to get these?
>     >
>     > Thanks again
>     > Rasanga
>     >
>     >
>     > --- On *Thu, 28/4/11, Eik Vettorazzi
>     > /<E.Vettorazzi_at_uke.uni-hamburg.de
>     <http://uk.mc1120.mail.yahoo.com/mc/compose?to=E.Vettorazzi@uke.uni-hamburg.de>>/*
>     wrote:
>     >
>     >
>     >     From: Eik Vettorazzi <E.Vettorazzi_at_uke.uni-hamburg.de
>     <http://uk.mc1120.mail.yahoo.com/mc/compose?to=E.Vettorazzi@uke.uni-hamburg.de>>
>     >     Subject: Re: [R] ROCR for combination of markers
>     >     To: "Rasanga Ruwanthi" <ruwanthi_kdr_at_yahoo.com
>     <http://uk.mc1120.mail.yahoo.com/mc/compose?to=ruwanthi_kdr@yahoo.com>>
>     >     Cc: r-help_at_r-project.org
>     <http://uk.mc1120.mail.yahoo.com/mc/compose?to=r-help@r-project.org>
>     >     Date: Thursday, 28 April, 2011, 13:11
>     >
>     >     ... and additionally, 'ROC' from the Epi package does the
>     second step
>     >     all in one.
>     >
>     >     Am 28.04.2011 13:01, schrieb Eik Vettorazzi:
>     >     > Hi Rasanga,
>     >     > you may have a look at the 'improveProb' function from the Hmisc
>     >     > package. There you can compare the increase in prognostic
>     power for
>     >     > several combinations of markers. You can create a ROC curve
>     for a
>     >     > combination of markers by using the predicted risks eg. from a
>     >     logistic
>     >     > regression model.
>     >     >
>     >     > To compare ROC curves of competing markers you can use
>     'roc.area.test'
>     >     > from the 'clinfun' package or 'hanley' from gcl.
>     >     >
>     >     > hth.
>     >     >
>     >     >
>     >     > Am 27.04.2011 23:17, schrieb Rasanga Ruwanthi:
>     >     >> Dear list
>     >     >>
>     >     >> I have 5 markers that can be used to detect an infection in
>     >     combination. Could you please advise me how to use functions in
>     >     ROCR/ other package to produce the ROC curve for a combination of
>     >     markers?
>     >     >>
>     >     >> I have used the following to get ROC statistics for each
>     marker.
>     >     >> pred <- prediction(y$marker1, y$infectn)
>     >     >> perf <-performance(pred,"tpr","fpr")
>     >     >> plot(perf,ave="threshold",spread.estimate="boxplot")
>     >     >>
>     >     >> But I want know whether we could get this for more than one
>     >     marker, so we can look at how good the markers in combination to
>     >     predict the infection. I'm very grateful for any suggestion/help.
>     >     >>
>     >     >> Thanks
>     >     >> Rasanga
>     >     >>
>     >     >>
>     >     >>     [[alternative HTML version deleted]]
>     >     >>
>     >     >>
>     >     >>
>     >     >>
>     >     >> ______________________________________________
>     >     >> R-help_at_r-project.org
>     <http://uk.mc1120.mail.yahoo.com/mc/compose?to=R-help@r-project.org>
>     >
>        <http://uk.mc1120.mail.yahoo.com/mc/compose?to=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
>     <http://www.r-project.org/posting-guide.html>
>     >     <http://www.r-project.org/posting-guide.html>
>     >     >> and provide commented, minimal, self-contained,
>     reproducible code.
>     >     >
>     >
> 
> 

>     --
>     Eik Vettorazzi
> 

>     Department of Medical Biometry and Epidemiology
>     University Medical Center Hamburg-Eppendorf
> 

>     Martinistr. 52
>     20246 Hamburg
> 

>     T ++49/40/7410-58243
>     F ++49/40/7410-57790
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Thu 28 Apr 2011 - 21:10:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Apr 2011 - 21:20:39 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive