-
Notifications
You must be signed in to change notification settings - Fork 0
/
roc_bb_norm1.m
56 lines (40 loc) · 1.19 KB
/
roc_bb_norm1.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%%%%%%%INPUT:
%%%%%%%nx: number of observations from the first class
%%%%%%%ny: number of observations from the second class
%%%%%%%nz: number of observations from the third class
%%%%%%%x: observations from the first class
%%%%%%%y: observations from the second class
%%%%%%%z: observations from the third class
%%%%%%%rep: resample size
%%%%%%%grid: the length of grid points
% Example:
nx=50;
ny=50;
nz=50;
%(-4, 3, 3, 4, 5, 5)
x=normrnd(-4,3,nx,1);
y=normrnd(3, 4, ny, 1);
z=normrnd(5, 5, nz, 1);
grid=0.0005
rep=1000
t= [grid:grid:1-grid] % FPF vector
ot=ones(length(t),1); % vector of 1 with the same length as vector t
onx=ones(nx,1);ony=ones(ny,1);onz=ones(nz,1);
%%%%%%%%%%%%%%%%%%%BB estimate of ROC, AUC;
for run=1:rep
% note: to generate Dirichlet weight vectors p and q
p=exprnd(1,1,ny);p=p/sum(p);
q=exprnd(1,1,nx);q=q/sum(q);
r=exprnd(1,1,nz);r=r/sum(r);
s=p*(y*onx'< ony*x');
r2(run,:) = q*(s'*ot'<onx*t);
v=p*(y*onz'< ony*z');
r3(run,:) = r*(v'*ot'<onz*t);
in(run,:)=r2(run,:).*(1-r3(run,:));
vus(run)=auc(in(run,:), grid)
end;
r2bb = mean(r2);
r3bb = mean(r3);
inbb=r2bb.*(1-r3bb);
vusbb=auc(inbb, grid);
vusbb1=sum(inbb)*grid;