/* ex3_5.do Example 3.5 data required: est1.dta Exercise Stress test and Chest pain history data from the CASS study paired data last update: 02 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_5, replace di di "{txt} **** Example 3.5 **** di di "{txt} Comparing tests with regression analysis - paired data example" di di "{txt} *****************" qui use ${semt_data}est1,clear /* expand data to long format: 2 records per subject; 1 test result for each record */ quietly { preserve qui gen int subject = _n expand = 2 sort subject by subj: gen byte test = _n==2 by subj: gen y = y1 if _n==1 by subj: replace y = y2 if _n==2 } di di "{txt} model to estimate rTPF(CPH,EST): di glm y test if d==1, family(binomial) link(log) cluster(subject) nolog eform di di di "*********************************** di di "{txt} model to estimate rFPF(CPH,EST): di glm y test if d==0, family(binomial) link(log) cluster(subject) nolog eform di qui log close end doit