{smcl} {txt}{sf}{ul off}{.-} name: {res} {txt}log: {res}/Users/steve/Documents/teaching/c2015/biostat208/labs/lab10/lab10.smcl {txt}log type: {res}smcl {txt}opened on: {res}12 Feb 2015, 16:10:52 {txt} {com}. . . drop if chol==. | chol==645 {txt}(13 observations deleted) {com}. drop if bmi<12 {txt}(1 observation deleted) {com}. . logistic chd69 chol sbp dibpat age smoke bmi, coef {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3140 {txt}{col 51}LR chi2({res}6{txt}){col 67}= {res} 184.43 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-794.79384{txt}{col 51}Pseudo R2{col 67}= {res} 0.1040 {txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} chd69{col 14}{c |} Coef.{col 26} Std. Err.{col 38} z{col 46} P>|z|{col 54} [95% Con{col 67}f. Interval] {hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}chol {c |}{col 14}{res}{space 2} .0106234{col 26}{space 2} .0015272{col 37}{space 1} 6.96{col 46}{space 3}0.000{col 54}{space 4} .0076301{col 67}{space 3} .0136167 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} .0182514{col 26}{space 2} .0041456{col 37}{space 1} 4.40{col 46}{space 3}0.000{col 54}{space 4} .0101262{col 67}{space 3} .0263766 {txt}{space 6}dibpat {c |}{col 14}{res}{space 2} .6972925{col 26}{space 2} .1443713{col 37}{space 1} 4.83{col 46}{space 3}0.000{col 54}{space 4} .41433{col 67}{space 3} .980255 {txt}{space 9}age {c |}{col 14}{res}{space 2} .0603351{col 26}{space 2} .0119705{col 37}{space 1} 5.04{col 46}{space 3}0.000{col 54}{space 4} .0368734{col 67}{space 3} .0837968 {txt}{space 7}smoke {c |}{col 14}{res}{space 2} .6038674{col 26}{space 2} .1410698{col 37}{space 1} 4.28{col 46}{space 3}0.000{col 54}{space 4} .3273756{col 67}{space 3} .8803592 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} .0535404{col 26}{space 2} .0267973{col 37}{space 1} 2.00{col 46}{space 3}0.046{col 54}{space 4} .0010187{col 67}{space 3} .1060621 {txt}{space 7}_cons {c |}{col 14}{res}{space 2}-12.25074{col 26}{space 2} .9832063{col 37}{space 1} -12.46{col 46}{space 3}0.000{col 54}{space 4}-14.17779{col 67}{space 3} -10.3237 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. predict phat {txt}(option pr assumed; Pr(chd69)) {com}. predict dxb, dbeta {txt} {com}. list id chd69 chol sbp dibpat age smoke bmi if id==10078 {txt} {c TLC}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c TRC} {c |} {res} id chd69 chol sbp dibpat age smoke bmi {txt}{c |} {c LT}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c RT} 1091. {c |} {res}10078 yes 188 166 B3,B4 43 nonsmoker 38.94737 {txt}{c |} {c BLC}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c BRC} {com}. gsort -dxb {txt} {com}. list id chd69 chol sbp dibpat age smoke bmi if _n<=10 {txt} {c TLC}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c TRC} {c |} {res} id chd69 chol sbp dibpat age smoke bmi {txt}{c |} {c LT}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c RT} 1. {c |} {res}10078 yes 188 166 B3,B4 43 nonsmoker 38.94737 {txt}{c |} 2. {c |} {res}12258 yes 198 176 B3,B4 59 nonsmoker 23.08595 {txt}{c |} 3. {c |} {res}12280 yes 162 190 A1,A2 56 nonsmoker 27.33347 {txt}{c |} 4. {c |} {res}13500 yes 169 132 B3,B4 57 smoker 29.01351 {txt}{c |} 5. {c |} {res} 3085 yes 241 190 A1,A2 51 nonsmoker 22.34883 {txt}{c |} {c LT}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c RT} 6. {c |} {res}11385 yes 212 130 A1,A2 40 nonsmoker 31.79607 {txt}{c |} 7. {c |} {res}21335 yes 267 120 B3,B4 54 smoker 31.32101 {txt}{c |} 8. {c |} {res}12752 yes 184 134 B3,B4 41 smoker 19.66339 {txt}{c |} 9. {c |} {res} 3182 yes 218 120 A1,A2 53 smoker 32.25329 {txt}{c |} 10. {c |} {res}10196 yes 298 102 B3,B4 52 smoker 19.2249 {txt}{c |} {c BLC}{hline 7}{c -}{hline 7}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c BRC} {com}. . . logistic chd69 chol sbp dibpat age smoke bmi if id != 10078, coef {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3139 {txt}{col 51}LR chi2({res}6{txt}){col 67}= {res} 184.79 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-792.10558{txt}{col 51}Pseudo R2{col 67}= {res} 0.1045 {txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} chd69{col 14}{c |} Coef.{col 26} Std. Err.{col 38} z{col 46} P>|z|{col 54} [95% Con{col 67}f. Interval] {hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}chol {c |}{col 14}{res}{space 2} .0107656{col 26}{space 2} .0015299{col 37}{space 1} 7.04{col 46}{space 3}0.000{col 54}{space 4} .007767{col 67}{space 3} .0137642 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} .0180712{col 26}{space 2} .0041567{col 37}{space 1} 4.35{col 46}{space 3}0.000{col 54}{space 4} .0099241{col 67}{space 3} .0262183 {txt}{space 6}dibpat {c |}{col 14}{res}{space 2} .7113087{col 26}{space 2} .1449475{col 37}{space 1} 4.91{col 46}{space 3}0.000{col 54}{space 4} .4272168{col 67}{space 3} .9954007 {txt}{space 9}age {c |}{col 14}{res}{space 2} .0610197{col 26}{space 2} .0119898{col 37}{space 1} 5.09{col 46}{space 3}0.000{col 54}{space 4} .0375202{col 67}{space 3} .0845192 {txt}{space 7}smoke {c |}{col 14}{res}{space 2} .6065078{col 26}{space 2} .1414284{col 37}{space 1} 4.29{col 46}{space 3}0.000{col 54}{space 4} .3293132{col 67}{space 3} .8837024 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} .0453055{col 26}{space 2} .0270511{col 37}{space 1} 1.67{col 46}{space 3}0.094{col 54}{space 4}-.0077137{col 67}{space 3} .0983247 {txt}{space 7}_cons {c |}{col 14}{res}{space 2}-12.10452{col 26}{space 2} .9856004{col 37}{space 1} -12.28{col 46}{space 3}0.000{col 54}{space 4}-14.03626{col 67}{space 3}-10.17278 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. . logistic chd69 chol sbp dibpat age smoke bmi {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3140 {txt}{col 51}LR chi2({res}6{txt}){col 67}= {res} 184.43 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-794.79384{txt}{col 51}Pseudo R2{col 67}= {res} 0.1040 {txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} chd69{col 14}{c |} Odds Ratio{col 26} Std. Err.{col 38} z{col 46} P>|z|{col 54} [95% Con{col 67}f. Interval] {hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}chol {c |}{col 14}{res}{space 2} 1.01068{col 26}{space 2} .0015435{col 37}{space 1} 6.96{col 46}{space 3}0.000{col 54}{space 4} 1.007659{col 67}{space 3} 1.01371 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} 1.018419{col 26}{space 2} .0042219{col 37}{space 1} 4.40{col 46}{space 3}0.000{col 54}{space 4} 1.010178{col 67}{space 3} 1.026728 {txt}{space 6}dibpat {c |}{col 14}{res}{space 2} 2.008308{col 26}{space 2} .289942{col 37}{space 1} 4.83{col 46}{space 3}0.000{col 54}{space 4} 1.513356{col 67}{space 3} 2.665136 {txt}{space 9}age {c |}{col 14}{res}{space 2} 1.062192{col 26}{space 2} .0127149{col 37}{space 1} 5.04{col 46}{space 3}0.000{col 54}{space 4} 1.037562{col 67}{space 3} 1.087408 {txt}{space 7}smoke {c |}{col 14}{res}{space 2} 1.829179{col 26}{space 2} .258042{col 37}{space 1} 4.28{col 46}{space 3}0.000{col 54}{space 4} 1.387322{col 67}{space 3} 2.411766 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} 1.055{col 26}{space 2} .0282711{col 37}{space 1} 2.00{col 46}{space 3}0.046{col 54}{space 4} 1.001019{col 67}{space 3} 1.111891 {txt}{space 7}_cons {c |}{col 14}{res}{space 2} 4.78e-06{col 26}{space 2} 4.70e-06{col 37}{space 1} -12.46{col 46}{space 3}0.000{col 54}{space 4} 6.96e-07{col 67}{space 3} .0000328 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. estat gof, table group(10) {txt}{title:{txt}Logistic{txt} model for chd69, goodness-of-fit test} (Table collapsed on quantiles of estimated probabilities) {c TLC}{hline 7}{c TT}{hline 8}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TRC} {c |} {res}Group {txt}{c |} {res} Prob {txt}{c |} {res}Obs_1 {txt}{c |} {res}Exp_1 {txt}{c |} {res}Obs_0 {txt}{c |} {res}Exp_0 {txt}{c |} {res}Total {txt}{c |} {c LT}{hline 7}{c +}{hline 8}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT} {c |} {res} 1 {txt}{c |} {res}0.0191 {txt}{c |} {res} 2 {txt}{c |} {res} 4.5 {txt}{c |} {res} 312 {txt}{c |} {res}309.5 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 2 {txt}{c |} {res}0.0273 {txt}{c |} {res} 9 {txt}{c |} {res} 7.3 {txt}{c |} {res} 305 {txt}{c |} {res}306.7 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 3 {txt}{c |} {res}0.0367 {txt}{c |} {res} 8 {txt}{c |} {res} 10.0 {txt}{c |} {res} 306 {txt}{c |} {res}304.0 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 4 {txt}{c |} {res}0.0464 {txt}{c |} {res} 10 {txt}{c |} {res} 13.0 {txt}{c |} {res} 304 {txt}{c |} {res}301.0 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 5 {txt}{c |} {res}0.0587 {txt}{c |} {res} 20 {txt}{c |} {res} 16.4 {txt}{c |} {res} 294 {txt}{c |} {res}297.6 {txt}{c |} {res} 314 {txt}{c |} {c LT}{hline 7}{c +}{hline 8}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT} {c |} {res} 6 {txt}{c |} {res}0.0729 {txt}{c |} {res} 15 {txt}{c |} {res} 20.5 {txt}{c |} {res} 299 {txt}{c |} {res}293.5 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 7 {txt}{c |} {res}0.0941 {txt}{c |} {res} 24 {txt}{c |} {res} 26.0 {txt}{c |} {res} 290 {txt}{c |} {res}288.0 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 8 {txt}{c |} {res}0.1220 {txt}{c |} {res} 47 {txt}{c |} {res} 33.5 {txt}{c |} {res} 267 {txt}{c |} {res}280.5 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 9 {txt}{c |} {res}0.1719 {txt}{c |} {res} 48 {txt}{c |} {res} 45.2 {txt}{c |} {res} 266 {txt}{c |} {res}268.8 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 10 {txt}{c |} {res}0.5528 {txt}{c |} {res} 73 {txt}{c |} {res} 79.5 {txt}{c |} {res} 241 {txt}{c |} {res}234.5 {txt}{c |} {res} 314 {txt}{c |} {c BLC}{hline 7}{c BT}{hline 8}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BRC} number of observations = {res} 3140 {txt}number of groups = {res} 10 {txt}Hosmer-Lemeshow chi2({res}8{txt}) = {res} 12.47 {txt}Prob > chi2 = {res} 0.1314 {txt} {com}. . summ bmi {txt} Variable {c |} Obs Mean Std. Dev. Min Max {hline 13}{c +}{hline 56} {space 9}bmi {c |}{res} 3140 24.51693 2.551602 15.6605 38.94737 {txt} {com}. gen bmic = bmi - r(mean) {txt} {com}. summ chol {txt} Variable {c |} Obs Mean Std. Dev. Min Max {hline 13}{c +}{hline 56} {space 8}chol {c |}{res} 3140 226.2513 42.78109 103 414 {txt} {com}. gen cholc = chol - r(mean) {txt} {com}. summ sbp {txt} Variable {c |} Obs Mean Std. Dev. Min Max {hline 13}{c +}{hline 56} {space 9}sbp {c |}{res} 3140 128.5796 15.00249 98 230 {txt} {com}. gen sbpc = sbp - r(mean) {txt} {com}. logistic chd69 dibpat age smoke c.bmic##c.cholc c.sbpc##c.bmic {txt}note: bmic omitted because of collinearity {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3140 {txt}{col 51}LR chi2({res}8{txt}){col 67}= {res} 198.96 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-787.53196{txt}{col 51}Pseudo R2{col 67}= {res} 0.1121 {txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} chd69{col 16}{c |} Odds Ratio{col 28} Std. Err.{col 40} z{col 48} P>|z|{col 56} [95% Con{col 69}f. Interval] {hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}dibpat {c |}{col 16}{res}{space 2} 2.064876{col 28}{space 2} .2991801{col 39}{space 1} 5.00{col 48}{space 3}0.000{col 56}{space 4} 1.554401{col 69}{space 3} 2.742992 {txt}{space 11}age {c |}{col 16}{res}{space 2} 1.060962{col 28}{space 2} .0127481{col 39}{space 1} 4.92{col 48}{space 3}0.000{col 56}{space 4} 1.036268{col 69}{space 3} 1.086245 {txt}{space 9}smoke {c |}{col 16}{res}{space 2} 1.835662{col 28}{space 2} .2588757{col 39}{space 1} 4.31{col 48}{space 3}0.000{col 56}{space 4} 1.39236{col 69}{space 3} 2.420105 {txt}{space 10}bmic {c |}{col 16}{res}{space 2} 1.111403{col 28}{space 2} .0334696{col 39}{space 1} 3.51{col 48}{space 3}0.000{col 56}{space 4} 1.047702{col 69}{space 3} 1.178977 {txt}{space 9}cholc {c |}{col 16}{res}{space 2} 1.01151{col 28}{space 2} .0015765{col 39}{space 1} 7.34{col 48}{space 3}0.000{col 56}{space 4} 1.008425{col 69}{space 3} 1.014604 {txt}{space 14} {c |} c.bmic#c.cholc {c |}{col 16}{res}{space 2} .9982604{col 28}{space 2} .000556{col 39}{space 1} -3.13{col 48}{space 3}0.002{col 56}{space 4} .9971712{col 69}{space 3} .9993507 {txt}{space 14} {c |} {space 10}sbpc {c |}{col 16}{res}{space 2} 1.021411{col 28}{space 2} .0043224{col 39}{space 1} 5.01{col 48}{space 3}0.000{col 56}{space 4} 1.012974{col 69}{space 3} 1.029918 {txt}{space 10}bmic {c |}{col 16}{res}{space 2} 1{col 28}{txt} (omitted) {space 14} {c |} {space 1}c.sbpc#c.bmic {c |}{col 16}{res}{space 2} .9964635{col 28}{space 2} .0014361{col 39}{space 1} -2.46{col 48}{space 3}0.014{col 56}{space 4} .9936527{col 69}{space 3} .9992822 {txt}{space 14} {c |} {space 9}_cons {c |}{col 16}{res}{space 2} .0021252{col 28}{space 2} .0012663{col 39}{space 1} -10.33{col 48}{space 3}0.000{col 56}{space 4} .0006611{col 69}{space 3} .0068324 {txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. estat gof, table group(10) {txt}{title:{txt}Logistic{txt} model for chd69, goodness-of-fit test} (Table collapsed on quantiles of estimated probabilities) {c TLC}{hline 7}{c TT}{hline 8}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TT}{hline 7}{c TRC} {c |} {res}Group {txt}{c |} {res} Prob {txt}{c |} {res}Obs_1 {txt}{c |} {res}Exp_1 {txt}{c |} {res}Obs_0 {txt}{c |} {res}Exp_0 {txt}{c |} {res}Total {txt}{c |} {c LT}{hline 7}{c +}{hline 8}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT} {c |} {res} 1 {txt}{c |} {res}0.0156 {txt}{c |} {res} 1 {txt}{c |} {res} 3.2 {txt}{c |} {res} 313 {txt}{c |} {res}310.8 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 2 {txt}{c |} {res}0.0252 {txt}{c |} {res} 6 {txt}{c |} {res} 6.4 {txt}{c |} {res} 308 {txt}{c |} {res}307.6 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 3 {txt}{c |} {res}0.0343 {txt}{c |} {res} 11 {txt}{c |} {res} 9.3 {txt}{c |} {res} 303 {txt}{c |} {res}304.7 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 4 {txt}{c |} {res}0.0451 {txt}{c |} {res} 13 {txt}{c |} {res} 12.4 {txt}{c |} {res} 301 {txt}{c |} {res}301.6 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 5 {txt}{c |} {res}0.0573 {txt}{c |} {res} 17 {txt}{c |} {res} 16.0 {txt}{c |} {res} 297 {txt}{c |} {res}298.0 {txt}{c |} {res} 314 {txt}{c |} {c LT}{hline 7}{c +}{hline 8}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c +}{hline 7}{c RT} {c |} {res} 6 {txt}{c |} {res}0.0728 {txt}{c |} {res} 12 {txt}{c |} {res} 20.4 {txt}{c |} {res} 302 {txt}{c |} {res}293.6 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 7 {txt}{c |} {res}0.0962 {txt}{c |} {res} 27 {txt}{c |} {res} 26.5 {txt}{c |} {res} 287 {txt}{c |} {res}287.5 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 8 {txt}{c |} {res}0.1263 {txt}{c |} {res} 43 {txt}{c |} {res} 34.7 {txt}{c |} {res} 271 {txt}{c |} {res}279.3 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 9 {txt}{c |} {res}0.1782 {txt}{c |} {res} 50 {txt}{c |} {res} 46.7 {txt}{c |} {res} 264 {txt}{c |} {res}267.3 {txt}{c |} {res} 314 {txt}{c |} {c |} {res} 10 {txt}{c |} {res}0.6178 {txt}{c |} {res} 76 {txt}{c |} {res} 80.3 {txt}{c |} {res} 238 {txt}{c |} {res}233.7 {txt}{c |} {res} 314 {txt}{c |} {c BLC}{hline 7}{c BT}{hline 8}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BT}{hline 7}{c BRC} number of observations = {res} 3140 {txt}number of groups = {res} 10 {txt}Hosmer-Lemeshow chi2({res}8{txt}) = {res} 8.50 {txt}Prob > chi2 = {res} 0.3866 {txt} {com}. . quietly regress chd69 dibpat age smoke c.bmic##c.cholc c.sbpc##c.bmic {txt} {com}. estat vif {txt} Variable {c |} VIF 1/VIF {hline 13}{c +}{hline 22} {space 6}dibpat {c |} {res} 1.02 0.982126 {txt}{space 9}age {c |} {res} 1.04 0.958207 {txt}{space 7}smoke {c |} {res} 1.04 0.962986 {txt}{space 8}bmic {c |} {res} 1.16 0.859868 {txt}{space 7}cholc {c |} {res} 1.04 0.965910 {txt}{space 6}c.bmic#{c |} {space 5}c.cholc {c |} {res} 1.01 0.991956 {txt}{space 8}sbpc {c |} {res} 1.16 0.860436 {txt}{space 6}c.sbpc#{c |} {space 6}c.bmic {c |} {res} 1.06 0.940621 {txt}{hline 13}{c +}{hline 22} Mean VIF {c |} {res} 1.07 {txt} {com}. . set seed 386282911 {txt} {com}. gen r = uniform() {txt} {com}. sort r {txt} {com}. gen group = 1 if _n <= _N*0.9 {txt}(314 missing values generated) {com}. replace group=2 if group!=1 {txt}(314 real changes made) {com}. tabulate group, summarize(chd69) nostandard {txt}{c |} Summary of CHD event group {c |} Mean Freq. {hline 12}{c +}{hline 24} 1 {c |} {res} .08067941 2826 {txt} 2 {c |} {res} .08917197 314 {txt}{hline 12}{c +}{hline 24} Total {c |} {res} .08152866 3140 {txt} {com}. logistic chd69 dibpat age smoke c.bmic##c.cholc c.sbpc##c.bmic if group==1 {txt}note: bmic omitted because of collinearity {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 2826 {txt}{col 51}LR chi2({res}8{txt}){col 67}= {res} 182.83 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-701.06775{txt}{col 51}Pseudo R2{col 67}= {res} 0.1154 {txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} chd69{col 16}{c |} Odds Ratio{col 28} Std. Err.{col 40} z{col 48} P>|z|{col 56} [95% Con{col 69}f. Interval] {hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}dibpat {c |}{col 16}{res}{space 2} 2.057755{col 28}{space 2} .3176788{col 39}{space 1} 4.67{col 48}{space 3}0.000{col 56}{space 4} 1.520492{col 69}{space 3} 2.784859 {txt}{space 11}age {c |}{col 16}{res}{space 2} 1.06647{col 28}{space 2} .0135884{col 39}{space 1} 5.05{col 48}{space 3}0.000{col 56}{space 4} 1.040167{col 69}{space 3} 1.093438 {txt}{space 9}smoke {c |}{col 16}{res}{space 2} 1.735499{col 28}{space 2} .257959{col 39}{space 1} 3.71{col 48}{space 3}0.000{col 56}{space 4} 1.296894{col 69}{space 3} 2.322439 {txt}{space 10}bmic {c |}{col 16}{res}{space 2} 1.120814{col 28}{space 2} .0356523{col 39}{space 1} 3.59{col 48}{space 3}0.000{col 56}{space 4} 1.05307{col 69}{space 3} 1.192915 {txt}{space 9}cholc {c |}{col 16}{res}{space 2} 1.011241{col 28}{space 2} .0016771{col 39}{space 1} 6.74{col 48}{space 3}0.000{col 56}{space 4} 1.007959{col 69}{space 3} 1.014533 {txt}{space 14} {c |} c.bmic#c.cholc {c |}{col 16}{res}{space 2} .9984765{col 28}{space 2} .0005983{col 39}{space 1} -2.54{col 48}{space 3}0.011{col 56}{space 4} .9973046{col 69}{space 3} .9996498 {txt}{space 14} {c |} {space 10}sbpc {c |}{col 16}{res}{space 2} 1.022465{col 28}{space 2} .0045461{col 39}{space 1} 5.00{col 48}{space 3}0.000{col 56}{space 4} 1.013594{col 69}{space 3} 1.031415 {txt}{space 10}bmic {c |}{col 16}{res}{space 2} 1{col 28}{txt} (omitted) {space 14} {c |} {space 1}c.sbpc#c.bmic {c |}{col 16}{res}{space 2} .9963087{col 28}{space 2} .0015281{col 39}{space 1} -2.41{col 48}{space 3}0.016{col 56}{space 4} .9933182{col 69}{space 3} .9993082 {txt}{space 14} {c |} {space 9}_cons {c |}{col 16}{res}{space 2} .0016991{col 28}{space 2} .0010751{col 39}{space 1} -10.08{col 48}{space 3}0.000{col 56}{space 4} .0004916{col 69}{space 3} .0058725 {txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. predict pht if group==2 {txt}(option pr assumed; Pr(chd69)) (2826 missing values generated) {com}. gsort -group {txt} {com}. . list group pht chol sbp dibpat age smoke bmi if _n<=10 {txt} {c TLC}{hline 7}{c -}{hline 10}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c TRC} {c |} {res}group pht chol sbp dibpat age smoke bmi {txt}{c |} {c LT}{hline 7}{c -}{hline 10}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c RT} 1. {c |} {res} 2 .2217527 274 136 A1,A2 49 smoker 24.32526 {txt}{c |} 2. {c |} {res} 2 .0115566 164 118 B3,B4 45 smoker 22.14871 {txt}{c |} 3. {c |} {res} 2 .1060665 266 140 B3,B4 47 smoker 22.03412 {txt}{c |} 4. {c |} {res} 2 .0820118 268 130 B3,B4 54 nonsmoker 24.27378 {txt}{c |} 5. {c |} {res} 2 .0632093 216 134 A1,A2 40 smoker 22.9551 {txt}{c |} {c LT}{hline 7}{c -}{hline 10}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c RT} 6. {c |} {res} 2 .0593077 222 152 B3,B4 46 nonsmoker 29.84368 {txt}{c |} 7. {c |} {res} 2 .0619958 230 138 B3,B4 51 nonsmoker 26.2549 {txt}{c |} 8. {c |} {res} 2 .0273902 207 138 B3,B4 39 nonsmoker 27.31674 {txt}{c |} 9. {c |} {res} 2 .1149939 263 142 A1,A2 45 nonsmoker 25.76582 {txt}{c |} 10. {c |} {res} 2 .0276563 185 124 A1,A2 47 smoker 19.78795 {txt}{c |} {c BLC}{hline 7}{c -}{hline 10}{c -}{hline 6}{c -}{hline 5}{c -}{hline 8}{c -}{hline 5}{c -}{hline 11}{c -}{hline 10}{c BRC} {com}. . lroc if group==2 {res} {txt}Logistic model for chd69 number of observations = {res} 314 {txt}area under ROC curve = {res} 0.7270 {txt} {com}. lsens if group==2 {res}{txt} {com}. . lstat if group==2, cutoff(0.1) {txt}Logistic model for chd69 {col 15}{hline 8} True {hline 8} Classified {c |}{col 22}D{col 35}~D {c |}{col 46}Total {hline 11}{c +}{hline 26}{c +}{hline 11} {col 6}+{col 12}{c |} {res} 19{col 28} 89{txt} {c |} {res} 108 {txt}{col 6}-{col 12}{c |} {res} 9{col 28} 197{txt} {c |} {res} 206 {txt}{hline 11}{c +}{hline 26}{c +}{hline 11} Total {c |} {res} 28{col 28} 286{txt} {c |} {res} 314 {txt}Classified + if predicted Pr(D) >= .1 True D defined as chd69 != 0 {hline 50} Sensitivity Pr( +| D){res} 67.86% {txt}Specificity Pr( -|~D){res} 68.88% {txt}Positive predictive value Pr( D| +){res} 17.59% {txt}Negative predictive value Pr(~D| -){res} 95.63% {txt}{hline 50} False + rate for true ~D Pr( +|~D){res} 31.12% {txt}False - rate for true D Pr( -| D){res} 32.14% {txt}False + rate for classified + Pr(~D| +){res} 82.41% {txt}False - rate for classified - Pr( D| -){res} 4.37% {txt}{hline 50} Correctly classified {res} 68.79% {txt}{hline 50} {com}. lstat if group==2, cutoff(0.2) {txt}Logistic model for chd69 {col 15}{hline 8} True {hline 8} Classified {c |}{col 22}D{col 35}~D {c |}{col 46}Total {hline 11}{c +}{hline 26}{c +}{hline 11} {col 6}+{col 12}{c |} {res} 3{col 28} 16{txt} {c |} {res} 19 {txt}{col 6}-{col 12}{c |} {res} 25{col 28} 270{txt} {c |} {res} 295 {txt}{hline 11}{c +}{hline 26}{c +}{hline 11} Total {c |} {res} 28{col 28} 286{txt} {c |} {res} 314 {txt}Classified + if predicted Pr(D) >= .2 True D defined as chd69 != 0 {hline 50} Sensitivity Pr( +| D){res} 10.71% {txt}Specificity Pr( -|~D){res} 94.41% {txt}Positive predictive value Pr( D| +){res} 15.79% {txt}Negative predictive value Pr(~D| -){res} 91.53% {txt}{hline 50} False + rate for true ~D Pr( +|~D){res} 5.59% {txt}False - rate for true D Pr( -| D){res} 89.29% {txt}False + rate for classified + Pr(~D| +){res} 84.21% {txt}False - rate for classified - Pr( D| -){res} 8.47% {txt}{hline 50} Correctly classified {res} 86.94% {txt}{hline 50} {com}. . capture binreg chd69 dibpat age smoke c.bmic##c.cholc c.sbpc##c.bmic, rr iterate(100) {txt} {com}. poisson chd69 dibpat age smoke c.bmic##c.cholc c.sbpc##c.bmic, irr robust {txt}note: bmic omitted because of collinearity {res} {txt}Iteration 0:{space 3}log pseudolikelihood = {res:-809.03452} Iteration 1:{space 3}log pseudolikelihood = {res:-809.00598} Iteration 2:{space 3}log pseudolikelihood = {res:-809.00597} {res} {txt}Poisson regression{col 51}Number of obs{col 67}= {res} 3140 {txt}{col 51}Wald chi2({res}8{txt}){col 67}= {res} 259.34 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log pseudolikelihood = {res}-809.00597{txt}{col 51}Pseudo R2{col 67}= {res} 0.0988 {txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 16}{c |}{col 28} Robust {col 1} chd69{col 16}{c |} IRR{col 28} Std. Err.{col 40} z{col 48} P>|z|{col 56} [95% Con{col 69}f. Interval] {hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {space 8}dibpat {c |}{col 16}{res}{space 2} 1.885479{col 28}{space 2} .2429655{col 39}{space 1} 4.92{col 48}{space 3}0.000{col 56}{space 4} 1.464653{col 69}{space 3} 2.427218 {txt}{space 11}age {c |}{col 16}{res}{space 2} 1.052683{col 28}{space 2} .0108212{col 39}{space 1} 4.99{col 48}{space 3}0.000{col 56}{space 4} 1.031686{col 69}{space 3} 1.074107 {txt}{space 9}smoke {c |}{col 16}{res}{space 2} 1.696515{col 28}{space 2} .2062327{col 39}{space 1} 4.35{col 48}{space 3}0.000{col 56}{space 4} 1.336852{col 69}{space 3} 2.15294 {txt}{space 10}bmic {c |}{col 16}{res}{space 2} 1.101012{col 28}{space 2} .0273448{col 39}{space 1} 3.87{col 48}{space 3}0.000{col 56}{space 4} 1.0487{col 69}{space 3} 1.155932 {txt}{space 9}cholc {c |}{col 16}{res}{space 2} 1.009803{col 28}{space 2} .0011662{col 39}{space 1} 8.45{col 48}{space 3}0.000{col 56}{space 4} 1.00752{col 69}{space 3} 1.012091 {txt}{space 14} {c |} c.bmic#c.cholc {c |}{col 16}{res}{space 2} .9985268{col 28}{space 2} .0003806{col 39}{space 1} -3.87{col 48}{space 3}0.000{col 56}{space 4} .9977812{col 69}{space 3} .9992729 {txt}{space 14} {c |} {space 10}sbpc {c |}{col 16}{res}{space 2} 1.017992{col 28}{space 2} .0033253{col 39}{space 1} 5.46{col 48}{space 3}0.000{col 56}{space 4} 1.011496{col 69}{space 3} 1.024531 {txt}{space 10}bmic {c |}{col 16}{res}{space 2} 1{col 28}{txt} (omitted) {space 14} {c |} {space 1}c.sbpc#c.bmic {c |}{col 16}{res}{space 2} .9969651{col 28}{space 2} .0011988{col 39}{space 1} -2.53{col 48}{space 3}0.011{col 56}{space 4} .9946184{col 69}{space 3} .9993174 {txt}{space 14} {c |} {space 9}_cons {c |}{col 16}{res}{space 2} .003102{col 28}{space 2} .001585{col 39}{space 1} -11.30{col 48}{space 3}0.000{col 56}{space 4} .0011395{col 69}{space 3} .0084447 {txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. . log close {txt}name: {res} {txt}log: {res}/Users/steve/Documents/teaching/c2015/biostat208/labs/lab10/lab10.smcl {txt}log type: {res}smcl {txt}closed on: {res}12 Feb 2015, 16:11:04 {txt}{.-} {smcl} {txt}{sf}{ul off}