LOG FOR A MANTEL-HAENSZEL STATISTIC FOR POLYNESIAN ISLAND DATA (making use of FORMATs for categorization) ================================================== 2/25/09 libname SAS "SASdat"; data poly; set SAS.polynest; run; * 80 obs, 16 variables ; options nodate nocenter linesize=80; proc format; value DEFOR LOW - 3 = 1 3.5 - 5 = 2 ; * Must use numeric format with numeric variable ; value LAT LOW - 12 = 0 12.1 - 50 = 1 ; value RAIN LOW - 1800 = 1 1801 - 3500 = 2 3501 - HIGH = 3 ; proc freq data=poly ; tables Deforstn LatitS Rain Deforstn * LatitS / chisq nocum norow nocol nopercent; format Deforstn DEFOR. LatitS LAT. rain RAIN. ; run; The FREQ Procedure Table of Deforstn by LatitS Deforstn LatitS Frequency|0 |1 | Total ---------+--------+--------+ 1 | 23 | 26 | 49 ---------+--------+--------+ 2 | 12 | 18 | 30 ---------+--------+--------+ Total 35 44 79 Frequency Missing = 1 Statistics for Table of Deforstn by LatitS Statistic DF Value Prob ------------------------------------------------------ Chi-Square 1 0.3631 0.5468 Likelihood Ratio Chi-Square 1 0.3644 0.5461 ... Mantel-Haenszel Chi-Square 1 0.3585 0.5494 * SO NOT MUCH APPEARS TO BE GOING ON IN THE WHOLE POPULATION OF 79 POLYNESIAN ISLANDS (EXCLUDING THE 1 MISSING DEFORSTN) BUT THIS POPULATION IS NOT AT ALL HOMOGENEOUS !! ; proc freq data=poly ; tables Rain * Deforstn * LatitS / /* NOTE the first variable is the "Styratifier" */ ALL nocum norow nocol nopercent; format Deforstn DEFOR. LatitS LAT. rain RAIN. ; run; * Not much going on in the 1 and 2 Rainfall categories, but in the high rainfall category (logically enough) we find low deforestation. ; Table 3 of Deforstn by LatitS Controlling for Rain=3 Deforstn LatitS Frequency|0 |1 | Total ---------+--------+--------+ 1 | 7 | 1 | 8 ---------+--------+--------+ 2 | 0 | 0 | 0 ---------+--------+--------+ Total 7 1 8 /* The next set of statistics gives estimates of RR and OR and CI's separately under the assumption that (each of) these is contant over all of the separate Rain 2x2 tables Deforstn x LatitS */ Estimates of the Common Relative Risk (Row1/Row2) Type of Study Method Value 95% Confidence Limits ------------------------------------------------------------------------- Case-Control Mantel-Haenszel 1.5238 0.5101 4.5522 (Odds Ratio) Logit ** 0.8579 0.2291 3.2116 Cohort Mantel-Haenszel 1.2619 0.6630 2.4017 (Col1 Risk) Logit ** 0.7992 0.4417 1.4461 Cohort Mantel-Haenszel 0.8701 0.6291 1.2034 (Col2 Risk) Logit 0.7108 0.5441 0.9285 /* But finally, we also have a test of whether there are differencesamong the odds ratios ! */ Summary Statistics for Deforstn by LatitS Controlling for Rain Breslow-Day Test for Homogeneity of the Odds Ratios ------------------------------ Chi-Square 7.1393 DF 1 Pr > ChiSq 0.0075 Effective Sample Size = 78 Frequency Missing = 2