3.55556

3.6 | 10 ratings Rate this file 422 downloads (last 30 days) File Size: 4.01 KB File ID: #19950

ROC curve

by Giuseppe Cardillo

 

16 May 2008 (Updated 06 Nov 2009)

Code covered by BSD License  

compute a ROC curve

Download Now | Watch this File

File Information
Description

ROC - Receiver Operating Characteristics.
The ROC graphs are a useful technique for organizing classifiers and visualizing their performance. ROC graphs are commonly used in medical decision making.
The function computes and plots the classical ROC curve and the mirrored ROC curve (in my opinion, it is more useful).

If you have downloaded partest
(http://www.mathworks.com/matlabcentral/fileexchange/12705) the routine will compute several data on test performance.

You can find more informations on:
http://www.advancedmcode.org/roc-curve.html

MATLAB release MATLAB 7.6 (R2008a)
Other requirements Optional: partest.m http://www.mathworks.com/matlabcentral/fileexchange/12705
Zip File Content  
Other Files license.txt,
roc.m,
rocdata.mat
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
04 Jun 2008 Brahim HAMADICHAREF

Good stuff.

24 Jun 2008 Truc Phan  
13 Jul 2008 Diego García Bascuñán

Good function

11 Aug 2008 Günther Eibl

easy to use!

20 Nov 2008 Pawel  
25 Jun 2009 Phong Vo

Thank you very much!

16 Jul 2009 cabrego

Nice function, but I think it may have a bug, I am getting different results for significantly overlaping distributions when I compare to medcalc, and online calculators.

email me for more details: cpabrego@gmail.com

24 Jul 2009 Michael

Agree with cabrego, this algorithm does not work correctly. Depending on the input data, it generates ROC curves with specificity and sensitivity backward. I believe this is because elements that fall below a cutoff value (I in the code) are called "true positives" when they should be "false positives". The convention is that higher values of a test are abnormal (positive).

I confirmed that other software (online ROC calculator, ROCR in R, STATA) does not behave this way with the same input data and all others produce correct results.

Use at your own risk.

29 Jul 2009 cabrego

I tested the new release and it is agreeing with other codes now. Michael, you may also wish to verify that the new version is working correctly.

I also think adding the cut off points as an additional x or y axis would be very useful to understand the trade off between sensitivity and sensibility.

27 Oct 2009 Jens Kaftan

Hi Giuseppe.
I have had a look at the new release today and I think it is still not perfectly correct. I have validated the scripts using the example data of Hanley and McNeil's 1982 paper: "The Meaning and Use of the Area under a Receiver Operating Characteristic (ROC) Curve", which seems to be the basis for the calculations (such as the approximation of Q_1 and Q_2) anyways. To my opinion the problem is that when integrating over the ROC curve to compute the AUC, the data point (sensitivity=1, specificity=0) is not considered when using the trapezoidal rule. Consequently the AUC value (and all AUC dependent measures) differ slightly from the example in the mentioned article (which becomes more severe for non-continous tests with only a few cut-off points).

Best,
Jens.

Please login to add a comment or rating.
Updates
12 Nov 2008

Changes in help section

19 Nov 2008

Test on significance of AUC added

03 Dec 2008

Input error handling added

10 Dec 2008

if mean(healthy)>mean(unhealthy) the function mirrors the curve to obtain the correct ROC curve.

10 Feb 2009

Mistake correction in z test computation

18 Feb 2009

Changes to make it compatible with uroccomp function

27 Jul 2009

bug correction

29 Jul 2009

New plot output

30 Jul 2009

According to cabrego comment, in the function output the table of cutoff points, sensibility and specificity.

02 Sep 2009

improved compatibility with URocomp

02 Sep 2009

In my previous submission I forgot to add the demo...

03 Sep 2009

advancedmcode link added in description section

18 Sep 2009

correction in ROC performance bounds

06 Nov 2009

I modified the files according to Jens Kaftan suggestion

Tag Activity for this File
Tag Applied By Date/Time
statistics Giuseppe Cardillo 22 Oct 2008 10:01:55
probability Giuseppe Cardillo 22 Oct 2008 10:01:55
roc Giuseppe Cardillo 22 Oct 2008 10:01:55
receiver operating characteristics Giuseppe Cardillo 22 Oct 2008 10:01:55
statistics Cristina McIntire 12 Nov 2008 14:31:44
probability Cristina McIntire 12 Nov 2008 14:31:44
curve Cristina McIntire 12 Dec 2008 15:40:31
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com