/* ex6_6.do example 6.6: figure 6.5 (generate and save coordinate data for graphics pkg import) data required: dp2.dta Stover/Gorga DPOAE test data last update: 23 Apr 2003 */ version 7 set more off cap semt_profile cap log close pause on set textsize 125 log using ${semt_log}ex6_6,replace use ${semt_data}dp2,clear replace y=-y gen xl=l/10 gen xf=f/100 gen xd=(amt-20)/10 if d==1 sort d by d:summ x* y regress y xf xl if d==0 pause q to continue . . . predict rhat0 if d==0,rstandard regress y xf xl xd if d==1 predict rhat1 if d==1,rstandard gen res=rhat1 if d==1 replace res=rhat0 if d==0 * std normal cdf of residuals: gen sncdf = norm(res) * empirical cdf of residuals: cumul res, gen(ecdf) /* normal probability plot a la pnorm: */ pnorm res,grid saving(${semt_log}figure6_5,replace) pause q to continue . . . /* save sncdf & ecdf for normal probability plot */ sort ecdf #delimit ; gr sncdf ecdf ecdf, s(.i) c(.l) xscale(0,1) yscale(0,1) xlab(0(.25)1) ylab(0(.25)1) xline(0(.25)1) yline(0(.25)1) ; #delimit cr keep sncdf ecdf order ecdf sncdf sort ecdf save ${semt_log}fig6_5,replace qui log close