Last active
November 8, 2017 10:59
-
-
Save DimChtz/9a95fe2a89370f9667089d8b1aa16028 to your computer and use it in GitHub Desktop.
A function that calculates AUC using sensitivity and specificity in Matlab.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function[auc] = calcAUC(sens, spec) | |
| tpr = sens; | |
| fpr = 1 - spec; | |
| [~, indices] = sort(sqrt(fpr.^2 + tpr.^2)); | |
| tpr = tpr(indices); | |
| fpr = fpr(indices); | |
| auc = trapz([0.0 fpr 1.0], [0.0 tpr 1.0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment