[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 : [EMAIL PROTECTED] [[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.
Re: [R] how to compute a roc curve
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@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. __ 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.
Re: [R] how to compute a roc curve
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 <[EMAIL PROTECTED]>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 : [EMAIL PROTECTED] > >[[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]] __ 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.
Re: [R] how to compute a roc curve
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 curve Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] 801.408.8111 > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > project.org] On Behalf Of Pau Marc Munoz Torres > Sent: Friday, October 31, 2008 8:25 AM > To: r-help@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 : [EMAIL PROTECTED] > > [[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.
Re: [R] how to compute a roc curve
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 The 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@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 __ 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.