ROC curve vertical average in MATLAB
Question
Is there a way to compute the vertical average (http://vicos.fri.uni-lj.si/data/vprsistemi/ROCintro.pdf) of several ROC curves in MATLAB? I've found in the MATLAB guide that perfcurve could do it, but I have no idea how to use it.
Solution
You can just concatenate the probability of detection arrays into a matrix and then take their mean. Assuming your probability of false alarms are held in the row vector PFA
and your probability of detection values are held in the row vectors PD1
, PD2
, ...:
PDMatrix = [PD1; PD2; ...];
PDMean = mean(PDMatrix, 1);
This assumes your ROC curves all share the same PFA values. If this isn't the case, then you can create a common PFA array and use interp1 to resample your PD arrays before averaging. For example, if you're interested in logarithmically spaced PFA values from 10^-6 to "near 1," and your PFA/PD pairs have the data to interpolate in this range, you can do something like
PFAResampled = logspace(-6, -.1, 1000);
PD1Resampled = interp1(PFA1, PD1, PFAResampled);
PD2Resampled = interp1(PFA2, PD2, PFAResampled);
After that, you can just concatenate and take the mean as shown above.