------------------------------------------------------------------------------------------------------ name: log: C:\MyDocs\MPH\LectureNotes\ClassDoLogData\logistic regression\5.12.EsophagealCa.ClassVers > ion.log log type: text opened on: 8 Jan 2010, 09:28:21 . * 5.12.EsophagealCa.ClassVersion.do . * . * Estimate age-adjusted risk of esophageal cancer due to dose of tobacco. . * . use C:\WDDtext\5.5.EsophagealCa.dta, clear . * . * Show frequency tables of effect of dose of tobacco on esophageal cancer. . * . tabulate cancer tobacco [freq=patients] , column +-------------------+ | Key | |-------------------| | frequency | | column percentage | +-------------------+ Esophageal | Tobacco (g/day) Cancer | 0-9 10-19 20-29 >= 30 | Total -----------+--------------------------------------------+---------- No | 447 178 99 51 | 775 | 85.14 75.42 75.00 62.20 | 79.49 -----------+--------------------------------------------+---------- Yes | 78 58 33 31 | 200 | 14.86 24.58 25.00 37.80 | 20.51 -----------+--------------------------------------------+---------- Total | 525 236 132 82 | 975 | 100.00 100.00 100.00 100.00 | 100.00 . * . * Analyze the Ille-et-Vilaine data using a logistic regression model . * that is analogous to model (5.24) in my text. . * . logistic cancer i.age i.tobacco [freq=patients] Logistic regression Number of obs = 975 LR chi2(8) = 157.68 Prob > chi2 = 0.0000 Log likelihood = -415.90235 Pseudo R2 = 0.1594 ------------------------------------------------------------------------------ cancer | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | 2 | 6.035932 6.433686 1.69 0.092 .7472235 48.75713 3 | 36.20831 37.10835 3.50 0.000 4.857896 269.8785 4 | 61.79318 63.10432 4.04 0.000 8.349838 457.3019 5 | 83.56952 85.86437 4.31 0.000 11.15506 626.0713 6 | 60.45383 64.52449 3.84 0.000 7.462882 489.7124 | tobacco | 2 | 1.835482 .3781838 2.95 0.003 1.225655 2.748731 3 | 1.945172 .487733 2.65 0.008 1.189947 3.179717 4 | 5.706139 1.725688 5.76 0.000 3.154398 10.3221 ------------------------------------------------------------------------------ . * . * Combine tobacco levels 2 and 3 in a new variable called smoke . * . generate smoke = tobacco . recode smoke 3=2 4=3 (smoke: 96 changes made) . label variable smoke "Smoking (gm/day)" . label define smoke 1 "0-9" 2 "10-29" 3 ">= 30" . label values smoke smoke . table smoke tobacco [freq=patients], row col --------------------------------------------- Smoking | Tobacco (g/day) (gm/day) | 0-9 10-19 20-29 >= 30 Total ----------+---------------------------------- 0-9 | 525 525 10-29 | 236 132 368 >= 30 | 82 82 | Total | 525 236 132 82 975 --------------------------------------------- . logistic cancer i.age i.smoke [freq=patients] Logistic regression Number of obs = 975 LR chi2(7) = 157.64 Prob > chi2 = 0.0000 Log likelihood = -415.92589 Pseudo R2 = 0.1593 ------------------------------------------------------------------------------ cancer | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- age | 2 | 6.037092 6.434914 1.69 0.092 .7473691 48.76637 3 | 36.2117 37.11182 3.50 0.000 4.85835 269.9038 4 | 61.79965 63.11096 4.04 0.000 8.350705 457.3503 5 | 83.52177 85.81492 4.31 0.000 11.14879 625.7078 6 | 60.25337 64.30389 3.84 0.000 7.439742 487.9831 | smoke | 2 | 1.873669 .3421356 3.44 0.001 1.309972 2.679933 3 | 5.704954 1.725242 5.76 0.000 3.153836 10.31965 ------------------------------------------------------------------------------ . lincom 3.smoke - 2.smoke ( 1) - [cancer]2.smoke + [cancer]3.smoke = 0 ------------------------------------------------------------------------------ cancer | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 3.044803 .9116938 3.72 0.000 1.693118 5.475594 ------------------------------------------------------------------------------ . log close name: log: C:\MyDocs\MPH\LectureNotes\ClassDoLogData\logistic regression\5.12.EsophagealCa.ClassVers > ion.log log type: text closed on: 8 Jan 2010, 09:28:24 ------------------------------------------------------------------------------------------------------