Hi Syed,
In MATLAB, while the `perfcurve` function is primarily designed to plot the ROC curve in terms of False Positive Rate (FPR) versus True Positive Rate (TPR), you can still use it to derive the necessary metrics to plot False Acceptance Rate (FAR) versus False Rejection Rate (FRR). Here's how you can achieve that:
Steps to Plot FAR vs FRR in MATLAB:
1. Use `perfcurve` to get FPR and TPR.
2. Calculate FAR and FRR from FPR and TPR.
3. Plot FAR against FRR.
Here's a sample MATLAB code to illustrate this:
scores = [0.1 0.4 0.35 0.8];
[X, Y, T, AUC] = perfcurve(labels, scores, 1);
plot(FAR, FRR, '-b', 'LineWidth', 2);
EER_index = find(abs(FAR - FRR) == min(abs(FAR - FRR)));
plot(FAR(EER_index), FRR(EER_index), 'ro', 'MarkerSize', 10, 'MarkerFaceColor', 'r');
text(FAR(EER_index), FRR(EER_index), sprintf(' EER = %.2f', EER), 'VerticalAlignment', 'bottom');
xlabel('False Acceptance Rate (FAR)');
ylabel('False Rejection Rate (FRR)');
title('ROC Curve for Equal Error Rate (EER)');
legend('ROC Curve', 'EER Point');
Explanation:
- FAR (False Acceptance Rate): This is equivalent to the False Positive Rate (FPR).
- FRR (False Rejection Rate): This is calculated as (1 - TPR).
- EER (Equal Error Rate): The point where FAR equals FRR.
By plotting FAR against FRR, you can identify the EER by finding the point where the two rates are equal or closest. The code provided will mark this point on the graph.
Thank you.