Code covered by the BSD License  

Highlights from
parametric ROC curve

image thumbnail

parametric ROC curve



Constructs the parametric ROC curve based on parametric choices provided by the user.

close all
clear all


%Lets generate the scores of two groups x,y 
%with x tending to exhibit smaller score values than y.
%For this example the inequality F_x(t)<F_y(t) for all t
%does not hold. This would hold for example in the case where
%the scores of the two groups follow two Normals with different means
%but with the same variance. Here, we just generate
%two populations that the one, loosely speaking, tends to exhibit
%higher score values. Here, we generate x from a Weibull distribution and 
%for y from a normal.


%Now plot the two (true) underlying densities populations just to see our setting:
hold on

close all
%Now suppose we want to construct the parametric ROC curve
%based on the assumption that X~Weibull, Y~Normal. The parameters
%of the models will be estimated via maximum likelihood (separately).

%We first define which models do we want to use:

%And then ask for the corresponding parametric ROC and its AUC (area under the curve): 
[rc aucparam]=paramroc(x,y,models)

%The rc is a function handle of the desired ROC curve and can be
%used to calclulate the value of ROC(t) at any t in [0,1]. For example:
at=[0.1 0.4 0.8 0.9 1];
hold on

close all

% You can additionally ask for the partial area under the curve (pAUC)
% that correspond to the range of the FPR (0.1 to 0.4)
[rc aucparam aucpartial]=paramroc(x,y,models,[0.1 0.4])

close all

% You can additionally ask for the empirical (i.e. non parametric)
% ROC curve along with the corresponding AUC
[rc aucparam aucpartial aucemp]=paramroc(x,y,models,[0.1 0.4],1)

close all

%You can derive a 95% confidence interval for the AUC of the parametric ROC
%based on the percentile bootstrap. Here we use 200 bootstrap samples:
%The CI is contained in CIareaparam.
[rc aucparam aucpartial aucemp CIareaparam]=paramroc(x,y,models,[],[],200)

%Note that now aucemp is NaN since the empirical curve is not requested
%You cou ask for
%[rc aucparam aucpartial aucemp CIareaparam]=paramroc(x,y,models,[],1,200)
%if you also want the empirical AUC

%Based on the same number of the bootstrap samples you can additionally ask
%the CIs for a partial area as well as the empirical area:

[rc aucparam aucpartial aucemp CIareaparam CIareapartial CIareaemp]=paramroc(x,y,models,[0.1 0.4],1,200)

close all
%Finally you can derive the corresponding 95% confidence intervals for the
%parametric ROC. For this you must provide an array of values of t at which
%the 95% CIs of ROC(t) are to be derived. Suppose we need the
%CIs at t=[0.1 0.4 0.8]:
t=[0.1 0.4 0.8];
[rc aucparam aucpartial aucemp CIareaparam CIareapartial CIareaemp CIparamroc]=paramroc(x,y,models,[0.1 0.4],1,100,t)

%The outpout CIparamroc is a three column matrix.
%Its first column is the t that you have provided.
%Its second and third column are the lower and upper limits of the CIs
%respectively. These CIs are also plotted with blue dots.
%Again, if you do not want the empirical curve plotted in your graph you
%could ask for:
%[rc aucparam aucpartial aucemp CIareaparam CIareapartial CIareaemp CIparamroc]=paramroc(x,y,models,[0.1 0.4],[],100,t)

%Finally if you want to see the 95% for a finer grid of t values: 
close all
[rc aucparam aucpartial aucemp CIareaparam CIareapartial CIareaemp CIparamroc]=paramroc(x,y,models,[0.1 0.4],1,100,t)
% close all
% [rc aucparam aucp aucemp ci]=paramroc(x,y,models,[0.1 0.4],[],100,t)

Contact us