ROC curve

August 25, 2009 by Giuseppe Cardillo 
Filed under: Statistics 
2 Comments
VN:F [1.8.1_1037]
Rating: +2 (from 2 votes)
VN:F [1.8.1_1037]
Rating: 7.5/10 (4 votes cast)

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).

An example of roc.m output plot

An example of roc.m output plot

The input is a Nx2 matrix: in the first column you must insert the test value and in the second you must insert 1 if the subject is a patient or 0 if he is healthy (or, more general, use 1 and 0 to discriminate the subsets of subjects).
I.E. X=[165 1; 140 1; .... 166 0; 176 0] (load rocdata) then call roc(X).

The function will return a table

ROC CURVE DATA
——————————————–
Cut-off point     Sensitivity     Specificity

131.0000          0.2414        0.9762
132.0000          0.2586        0.9762

151.0000          0.7500        0.8095
152.0000          0.8017        0.8095

218.0000          1.0000        0.0476
239.0000          1.0000        0.0238
——————————————————————————–

and the statistic results:

ROC CURVE ANALYSIS

——————————————————————————–
AUC        S.E.           95% C.I.          Comment
——————————————————————————–
0.87541    0.02713    0.82224    0.92858    Good test
——————————————————————————–
Standardized AUC       1-tail p-value
13.8375                0.000000            The area is statistically greater than 0.5

Cut-off point for best Sensitivity and Specificity (blu circle in plot)= 152.0000
In the ROC plot, the cut-off point is the closest to [0,1] point or, if you want, the closest to the green line

where AUC is Area under the curve and S.E. is Standard Error

If you have downloaded partest (http://www.advancedmcode.org/partest.html) the routine will compute several data on test performance.

If any problems occurs in execution, or if you found a bug, have a suggestion or question just contact me at:

giuseppe dot cardillo-edta at poste dot it

You can visit my homepage http://home.tele2.it/cardillo

My profile on XING http://www.xing.com/go/invita/13675097

My profile on LinkedIN http://it.linkedin.com/in/giuseppecardillo

Download Now

VN:F [1.8.1_1037]
Rating: 7.5/10 (4 votes cast)
VN:F [1.8.1_1037]
Rating: +2 (from 2 votes)
ROC curve7.5104

Popularity: 31% [?]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • Live
  • PDF
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • email
  • MySpace
  • RSS

Related Posts

Comments

2 Comments on ROC curve

  1. Bob on Thu, 10th Dec 2009 23:20
  2. Hi,

    I used your code, however I god a second red straight line drawn ?

    http://img14.imageshack.us/img14/7475/2ndline.jpg

    How would you explain the 2nd line ?

    Thank you in advance,

    UN:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.1_1037]
    Rating: 0 (from 0 votes)

    [Reply]


    Giuseppe Cardillo Reply:

    Hi Bob,
    thank you for your email. It seems a closed polygon…
    I have recently updated roc.m: Jens Kaftan suggested to include the points (0,0) and (1,1) to improve the area estimation when there are few points. In the uploaded file there was a bug that I fixed several days after. Probably, you downloaded the file before this bug fixing.
    Anyway, you can download the last version of roc.m or send me the data and I’ll try to understand if there is another bug.
    Thank you again
    Giuseppe

    UA:F [1.8.1_1037]
    Rating: 0.0/5 (0 votes cast)
    UA:F [1.8.1_1037]
    Rating: 0 (from 0 votes)

    [Reply]

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!


Include MATLAB code in your comment by doing the following:

<pre lang="MATLAB">

%insert code here

</pre>