/* ex3_6.do Example 3.6 data required: lplaudio_b.dta Leisenring neonatal audiology data last update: 06 September 2005 */ version 9 set more off cap semt_profile cap log close cap pro drop doit program define doit log using ${semt_log}ex3_6, replace di di "{txt} **** Example 3.6 **** di di "{txt} Comparing tests with regression analysis" di di "{txt} *****************" quietly use ${semt_data}lplaudio_b,clear preserve quietly keep if test < 3 /* use only test A & B from this dataset */ la def impairment 0 normal 1 impaired la val d impairment di "{txt} Table 3.11" di di " (a) unpaired marginal representation" table test y d, scsepwidth(7) csepwidth(4) di * collapse to one record and 2 test variables for each subject-ear: qui egen cid_ear = group(cid ear) tempfile f1 qui save `f1' qui reshape wide y, i(cid_ear) j(test) la var y1 "test B" la var y2 "test A" di " (b) paired cross-classification (restricted to ears with both test results)" table y2 y1 d , scsepwidth(7) csepwidth(4) di di "{txt} *******************" * restore uncollapsed dataset qui use `f1', clear *** qui gen byte xtest = test==2 di "{txt} model to estimate rTPF(A,B) with single test covariate " di "{txt} (clustering on subject): di glm y xtest if d==1, family(binomial) link(log) nolog eform cluster(cid) di di "{txt} *************" di "{txt} model to estimate rFPF(A,B) with single test covariate: " di "{txt} (clustering on subject): di glm y xtest if d==0, family(binomial) link(log) nolog eform cluster(cid) di qui gen xsev = sev/10.0 qui gen byte test_x_loc = xtest*loc gen byte test_x_sev = xtest*xsev di "{txt} *******************" di "{txt} models corresponding to Table 3.12 di di "{txt} (a) model to estimate rTPF(A,B) including covariates for location and severity " di "{txt} (clustering on subject): di glm y xtest loc xsev test_x_loc test_x_sev if d==1, family(binomial) link(log) nolog eform cluster(cid) di di "{txt} *************" di "{txt} (b) model to estimate rFPF(A,B) including covariates for location" di "{txt} (clustering on subject): di glm y xtest loc test_x_loc if d==0, family(binomial) link(log) nolog eform cluster(cid) di qui log close end doit