Hi, I'm trying to set up a prediction software, now i testing the performance of my method, so i need to calculate a ROC curve, specially auc, cut-off, sens and spec, i just looking at ROCH package, but it's a mass for me, i'm not a math guy and I'm getting lost Could any of you recommend me an easy-to-use package to do this task? i just have a list of positive/negative samples and his score on my program. can I compute a roc curve with this? thanks pau -- Pau Marc Muñoz Torres Laboratori de Biologia Computacional Institut de Biotecnologia i Biomedicina Vicent Villar Universitat Autonoma de Barcelona E-08193 Bellaterra (Barcelona) telèfon: 93 5812807 Email : paumarc.munoz@bioinf.uab.cat [[alternative HTML version deleted]]
Try library("ROCR") Pau Marc Munoz Torres wrote:> Hi, > > I'm trying to set up a prediction software, now i testing the performance > of my method, so i need to calculate a ROC curve, specially auc, cut-off, > sens and spec, i just looking at ROCH package, but it's a mass for me, i'm > not a math guy and I'm getting lost > > Could any of you recommend me an easy-to-use package to do this task? i just > have a list of positive/negative samples and his score on my program. can I > compute a roc curve with this? > > thanks > > pau > > > ------------------------------------------------------------------------ > > ______________________________________________ > 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.
Dear Pau, Take a look at lroc in the epicalc package. HTH, Jorge On Fri, Oct 31, 2008 at 10:25 AM, Pau Marc Munoz Torres <paumarc@gmail.com>wrote:> Hi, > > I'm trying to set up a prediction software, now i testing the performance > of my method, so i need to calculate a ROC curve, specially auc, cut-off, > sens and spec, i just looking at ROCH package, but it's a mass for me, i'm > not a math guy and I'm getting lost > > Could any of you recommend me an easy-to-use package to do this task? i > just > have a list of positive/negative samples and his score on my program. can I > compute a roc curve with this? > > thanks > > pau > -- > Pau Marc Muñoz Torres > > Laboratori de Biologia Computacional > Institut de Biotecnologia i Biomedicina Vicent Villar > > Universitat Autonoma de Barcelona > E-08193 Bellaterra (Barcelona) > > telèfon: 93 5812807 > Email : paumarc.munoz@bioinf.uab.cat > > [[alternative HTML version deleted]] > > > ______________________________________________ > 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. > >[[alternative HTML version deleted]]
There are various packages that do ROC curves (others have mentioned some, you can search for the others), but ROC curves are not that hard to do by hand in R. Using the classic iris dataset, we can use Sepal.Length as the test/score and species=='virginica' as the true pos/neg that we are trying to predict. One way to compute the ROC curve, auc and values is:> xx <- c( -Inf, sort(unique(iris$Sepal.Length)), Inf ) > sens <- sapply(xx, function(x) with(iris,+ mean( Sepal.Length[Species=='virginica'] >= x ) ) )> spec <- sapply(xx, function(x) with(iris,+ mean( Sepal.Length[Species!='virginica'] < x ) ) )> plot( 1-spec, sens, type='l' ) > > ch <- chull(1-spec,sens) > lines(1-spec[ch], sens[ch], col='green') > > integrate( approxfun(spec, sens), 0, 1) # Area under curveHope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Pau Marc Munoz Torres > Sent: Friday, October 31, 2008 8:25 AM > To: r-help at r-project.org > Subject: [R] how to compute a roc curve > > Hi, > > I'm trying to set up a prediction software, now i testing the > performance of my method, so i need to calculate a ROC curve, specially > auc, cut-off, sens and spec, i just looking at ROCH package, but it's a > mass for me, i'm not a math guy and I'm getting lost > > Could any of you recommend me an easy-to-use package to do this task? i > just have a list of positive/negative samples and his score on my > program. can I compute a roc curve with this? > > thanks > > pau > -- > Pau Marc Mu?oz Torres > > Laboratori de Biologia Computacional > Institut de Biotecnologia i Biomedicina Vicent Villar > > Universitat Autonoma de Barcelona > E-08193 Bellaterra (Barcelona) > > tel?fon: 93 5812807 > Email : paumarc.munoz at bioinf.uab.cat > > [[alternative HTML version deleted]]
Pau Marc Munoz Torres wrote:> Hi, > > I'm trying to set up a prediction software, now i testing the performance > of my method, so i need to calculate a ROC curve, specially auc, cut-off, > sens and spec, i just looking at ROCH package, but it's a mass for me, i'm > not a math guy and I'm getting lostThe use of any cutoffs will result in inefficient and arbitrary analyses, and note that sensitivity and specificity are improper scoring rules (they are optimized by a bogus model). Frank> > Could any of you recommend me an easy-to-use package to do this task? i just > have a list of positive/negative samples and his score on my program. can I > compute a roc curve with this? > > thanks > > pau > > > ------------------------------------------------------------------------ > > ______________________________________________ > 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.-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University