Dear Doc@Duke,
Thank so much for help. I am successfully generated 1000 bootstrap samples from the original data. The new dataset include (c1 c2 y id bootsamp). For each bootstrap sample, I need to calculate MGYI and associated c1 and c2 by using the following code. It seems macro need to be used here. Need your help on setting macro (I am not good with macro). I would appreciated.
data rocBP;
set rocBP;
Sensitivity = 1-probbnrm((c1-35.4)/6.63,(c2-142.5)/29.64, 0);
FP = 1-probbnrm((c1-30.8)/6.57,(c2-110.8)/24.8, 0);
FPR=FP;
condition = ceil(FPR*200)/200 ;
Costp01 = (probnorm((c1-35.4)/6.63))* 0.1 + (probnorm((c1-30.8)/6.57))*(1-0.1) ;
run;quit;
proc sort data=rocBP; by FP;run;quit;
proc means data=rocBP max noprint;
var Sensitivity; by FP;
output out=mrocBP (drop=_type_ _freq_)
max=MTPR
maxid(Sensitivity(condition))=condition ;
format FP lessthan.;
run;quit;
/**************************************** MCMROC******************************************************************************/
******************************************BP, p=0.1, q=1 *******************************************;
proc sort data=rocBP; by condition ;run;
proc sort data=mrocBP; by condition ;run;
data mrocBPq;
merge rocBP mrocBP;
by condition;
run;
data mrocBPq1;
set mrocBPq;
TPRmaxq = 1 * MTPR ;
if Sensitivity >= TPRmaxq then q=1;
else q=0;
if q=0 then delete;
run;
proc sort data=mrocBPq1 ; by FP;run;
proc means data=mrocBPq1 min noprint;
var Costp01; by FP;
output out=mincBPq1p01 (drop=_type_ _freq_)
min=cost
minid(Costp01(c1))=c1
minid(Costp01(c2))=c2
minid(Costp01(FPR))=FPR
minid(Costp01(condition))=condition
minid(Costp01(MTPR))=MTPR
minid(Costp01(Sensitivity))=Sensitivity;
format FP lessthan.;
run;quit;
/**** Calculate optimal operating point(MGYI) *** *************************************************************************/
data Optimalq1p01a10;
set mincBPq1p01;
GYI = Sensitivity + ((1-0.1)/(10*0.1)) * (1- FPR);
run;
data costq1p01a10;
set Optimalq1p01a10;
run;
proc means data=costq1p01a10 max noprint;
var GYI;
output out=MGYIcq1p01a10 (drop=_type_ _freq_)
maxid(GYI(c1))=c1
maxid(GYI(c2))=c2
max=MGYI ;
run;
proc print data = MGYIcq1p01a10; run;
... View more