/* ms2_fig5.do do-file to generate figure 5 and table 1 for SJ manuscript: "Accomodating covariates in ROC analysis". Janes H, Longton G, and Pepe M. uses Norton neonatal audoilogy dataset: nnhs2.dta and -rocreg- version 1.0.8 or later last update: 4/14/2008 */ version 10.0 cap log close set scheme sj use http://www.fhcrc.org/science/labs/pepe/book/data/nnhs2, clear log using sjms2_tab1.txt, replace rocreg d y1, adjcov(currage gender) adjm(linear) regcov(currage) cl(id) nobs qui log close matrix B = e(GLMparm) matrix list B sca alpha_0 = B[1,1] sca alpha_1 = B[1,2] sca alpha_2 = B[1,3] #delimit ; twoway function y = normal(alpha_0 + alpha_1*invnormal(x) + alpha_2*30), range(1e-09 1) clw(*1.5) clp(solid) lc(gs0) || function y = normal(alpha_0 + alpha_1*invnormal(x) + alpha_2*40), range(1e-09 1) clw(*1.5) clp(dash) lc(gs0) || function y = normal(alpha_0 + alpha_1*invnormal(x) + alpha_2*50), range(1e-09 1) clw(*1.5) clp(shortdash) lc(gs0) || function y = x, range(0 1) clw(*0.8) clp(solid) lc(gs13) xlab(0 1) ylab(0 1, angle(horizontal)) xline(0(.2)1,lstyle(grid) lcolor(gs13) lw(thin)) yline(0(.2)1,lstyle(grid) lcolor(gs13) lw(thin)) ytitle(TPR, size(4) justification(center) orientation(horizontal)) yscale(titlegap(2)) xtitle(FPR, size(4) justification(center) margin(b=0)) xscale(r(0 1) titlegap(1.5)) legend(order(1 2 3) ring(1) pos(3) cols(1) size(3.0) title("Age (months)", size(3.2) margin(b=2)) label(1 "30") label(2 "40") label(3 "50") keygap(2) rowgap(1.0) symx(8) region(fcolor(white) lcolor(white) margin(r=1 l=1 t=1 b=1)) bmargin(l=10) ) aspectratio(1) plotregion(margin(l=2 r=2 t=2 b=2) ) graphregion(margin(l=6 r=6 t=6 b=4)) name(g1, replace) ;