/* fig6_9.do figure 6.9 (from example 6.13) generate and save plot coordinate data for graphics pkg import ROC(t) = PHI( alpha_0 + alpha_1*phi_inv(t) + beta_1*x_type + beta_2*x_time + beta_3*x_type*x_time + beta_4*x_age ) modified 10/30/02 and again 11/1/02 per changes in ex6_13.do */ version 7 set more off cap semt_profile pause on /* updated estimates from ex6_13.do, 10/29/02 : age centered at 50 */ local alpha_0 = 1.297 local alpha_1 = 0.766 local beta_1 = 0.584 /* x_type: 0 = ratio, 1 = total */ local beta_2 = -0.0895 /* x_time: years prior to diagnosis. */ local beta_3 = -0.0821 local beta_4 = -0.133 /* x_age = 6.5 for a 65 year old male */ local x_age = 1.5 /* (65 - 50)/10 for a 65 y.o. */ drop _all range t 0 1 500 set textsize 200 foreach x_time of numlist 0 2 4 8 { foreach x_type in 1 0 { if `x_type'==1 {local typelab = "total"} else {local typelab = "ratio"} #delimit ; gen roc`x_time'`typelab' = norm( `alpha_0' + `alpha_1'*invnorm(t) + `beta_1'*`x_type' + `beta_2'*`x_time' + `beta_3'*`x_type'*`x_time' + `beta_4'*`x_age' ) ; #delimit cr recode roc`x_time'`typelab' . = 0 if t==0 recode roc`x_time'`typelab' . = 1 if t==1 } } sort t gen forty5 = t if t==0 | t==1 sort t tempfile g0 g2 g4 g8 set textsize 125 foreach time of numlist 0 2 4 8 { gr roc`time'* forty5 t, s(...) c(lll) saving(`g`time'') pause } gr using `g0' `g2' `g4' `g8', margin(5) t1("Fig. 6.9") saving(${semt_log}fig6_9,replace) keep t roc* sort t save ${semt_log}fig6_9, replace