version 9.2 log using C:\Teaching\IGP\log\17.chisquare.log, replace * Chapter 16 & 17 * modified on Feb. 13, 2007 by Leena Choi *************************************************************************************** * Chapter 16 *************************************************************************************** use "C:\Teaching\IGP\data\ex1chapter16.dta", clear * cohort study design cs disease treatment, or woolf * case-control design cc disease treatment, woolf * we can calculate RD, RR and OR without the data csi 10 20 90 80, or woolf csi 20 40 80 60, or woolf *************************************************************************************** * Chapter 17 *************************************************************************************** * if you want to conduct chi square test using the previous example tabulate disease treatment, chi * calculate p-value corresponding to chi square statistic di chi2tail(1, 3.92) ***** 3*2 table use "C:\Teaching\IGP\data\ex2chapter17.dta", clear * conduct chi square test for 3*2 table tabulate disease treatment [weight=freq], chi * confirm your calculation di 8^2*(1/18 + 1/82) + 7^2*(1/27 + 1/123) + 14^2*(1/36+1/164) * calculate p-value corresponding to chi square statistic di chi2tail(2, 13.188799) * display 2 tables of 2*2 table use "C:\Teaching\IGP\data\EMS\perulung.dta", clear gen fevcat = 0 replace fevcat = 1 if fev1 > 1.58 table fevcat respsymptoms male log close