{smcl} {com}{sf}{ul off}{txt}{.-} name: {res} {txt}log: {res}/Users/steve/Documents/teaching/c2015/biostat208/labs/lab9/lab9.smcl {txt}log type: {res}smcl {txt}opened on: {res} 3 Mar 2015, 15:15:53 {txt} {com}. . * smoking indicator . gen smoke = ncig {txt} {com}. recode smoke 0 = 0 1/max = 1 {txt}(smoke: 1495 changes made) {com}. label define smlab 0 "nonsmoker" 1 "smoker" {txt} {com}. label val smoke smlab {txt} {com}. . * adjusted assoc. between CHD & type A behavior . . * using cs . cs chd69 dibpat, by(smoke) or {txt}smoke {c |}{col 26}OR{col 35}[95% Conf. Interval] M-H Weight {hline 17}{c +}{hline 49} nonsmoker {c |} {res} 2.941176 1.882394 4.594855 12.10169{txt} (Cornfield) smoker {c |} {res} 1.962697 1.385228 2.780702 23.66644{txt} (Cornfield) {hline 17}{c +}{hline 49} Crude {c |} {res} 2.372929 1.804034 3.121147{txt}{col 69} M-H combined {c |} {res} 2.293753 1.741568 3.021016 {txt}{hline 17}{c BT}{hline 49} Test of homogeneity (M-H) chi2({res}1{txt}) ={res} 1.938{txt} Pr>chi2 = {res}0.1639 {txt}Test that combined OR = 1: Mantel-Haenszel chi2(1) ={res} 36.68 {txt}Pr>chi2 ={res} 0.0000 {txt} {com}. . * using logistic regression . logistic chd69 i.dibpat i.smoke {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3154 {txt}{col 51}LR chi2({res}2{txt}){col 67}= {res} 60.51 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-860.36587{txt}{col 51}Pseudo R2{col 67}= {res} 0.0340 {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 6}dibpat {c |} {space 6}A1,A2 {c |}{col 14}{res}{space 2} 2.301319{col 26}{space 2} .3238094{col 37}{space 1} 5.92{col 46}{space 3}0.000{col 54}{space 4} 1.746657{col 67}{space 3} 3.032117 {txt}{space 12} {c |} {space 7}smoke {c |} {space 5}smoker {c |}{col 14}{res}{space 2} 1.8002{col 26}{space 2} .2422866{col 37}{space 1} 4.37{col 46}{space 3}0.000{col 54}{space 4} 1.382798{col 67}{space 3} 2.343597 {txt}{space 7}_cons {c |}{col 14}{res}{space 2} .0393656{col 26}{space 2} .0054842{col 37}{space 1} -23.22{col 46}{space 3}0.000{col 54}{space 4} .0299593{col 67}{space 3} .0517251 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. . * binary version of age . gen dage = age {txt} {com}. recode dage 39/49=0 50/59=1 {txt}(dage: 3154 changes made) {com}. label define dagelab 0 "39-49" 1 "50-59" {txt} {com}. label val dage dagelab {txt} {com}. . . * Assoc. between CHD, age & arcus . cs chd69 arcus, or {col 18}{txt}{c |} arcus senilis{col 43}{c |} {col 18}{c |} Exposed Unexposed {c |} Total {hline 17}{c +}{hline 24}{c +}{hline 12} Cases {c |} {res} 102 153{txt} {c |} {res} 255 {txt}Noncases {c |} {res} 839 2058{txt} {c |} {res} 2897 {txt}{hline 17}{c +}{hline 24}{c +}{hline 12} {col 12}Total {c |} {res} 941 2211{txt} {c |} {res} 3152 {txt}{col 18}{c |}{col 43}{c |} Risk {c |} {res} .1083953 .0691995{txt} {c |} {res} .080901 {txt}{col 18}{c |}{col 43}{c |} {col 18}{c |} Point estimate {c |} [95% Conf. Interval] {col 18}{c LT}{hline 24}{c +}{hline 24} Risk difference {c |} {res}{col 27} .0391959{txt}{col 43}{c |} {res} .0166915 .0617003{txt} Risk ratio {c |} {res}{col 27} 1.566419{txt}{col 43}{c |} {res} 1.233865 1.988603{txt} Attr. frac. ex. {c |} {res}{col 27} .3616011{txt}{col 43}{c |} {res} .1895387 .4971343{txt} Attr. frac. pop {c |} {res}{col 27} .1446404{txt}{col 43}{c |} Odds ratio {c |} {res}{col 27} 1.63528{txt}{col 43}{c |} {res} 1.257732 2.126197{txt} (Cornfield) {col 18}{c BLC}{hline 24}{c BT}{hline 24} {col 22} chi2(1) ={res} 13.64{txt} Pr>chi2 ={res} 0.0002 {txt} {com}. cs chd69 dage, or {col 18}{txt}{c |} dage{col 43}{c |} {col 18}{c |} Exposed Unexposed {c |} Total {hline 17}{c +}{hline 24}{c +}{hline 12} Cases {c |} {res} 112 145{txt} {c |} {res} 257 {txt}Noncases {c |} {res} 793 2104{txt} {c |} {res} 2897 {txt}{hline 17}{c +}{hline 24}{c +}{hline 12} {col 12}Total {c |} {res} 905 2249{txt} {c |} {res} 3154 {txt}{col 18}{c |}{col 43}{c |} Risk {c |} {res} .1237569 .0644731{txt} {c |} {res} .0814838 {txt}{col 18}{c |}{col 43}{c |} {col 18}{c |} Point estimate {c |} [95% Conf. Interval] {col 18}{c LT}{hline 24}{c +}{hline 24} Risk difference {c |} {res}{col 27} .0592838{txt}{col 43}{c |} {res} .0355493 .0830183{txt} Risk ratio {c |} {res}{col 27} 1.919512{txt}{col 43}{c |} {res} 1.51876 2.42601{txt} Attr. frac. ex. {c |} {res}{col 27} .4790343{txt}{col 43}{c |} {res} .3415682 .5878006{txt} Attr. frac. pop {c |} {res}{col 27} .208762{txt}{col 43}{c |} Odds ratio {c |} {res}{col 27} 2.04938{txt}{col 43}{c |} {res} 1.58146 2.655782{txt} (Cornfield) {col 18}{c BLC}{hline 24}{c BT}{hline 24} {col 22} chi2(1) ={res} 30.30{txt} Pr>chi2 ={res} 0.0000 {txt} {com}. cs chd69 arcus, by(dage) or {txt}dage {c |}{col 26}OR{col 35}[95% Conf. Interval] M-H Weight {hline 17}{c +}{hline 49} 39-49 {c |} {res} 1.911643 1.348286 2.710533 20.34964{txt} (Cornfield) 50-59 {c |} {res} 1.0575 .7086192 1.578275 23.00885{txt} (Cornfield) {hline 17}{c +}{hline 49} Crude {c |} {res} 1.63528 1.257732 2.126197{txt}{col 69} M-H combined {c |} {res} 1.458379 1.118748 1.901115 {txt}{hline 17}{c BT}{hline 49} Test of homogeneity (M-H) chi2({res}1{txt}) ={res} 4.742{txt} Pr>chi2 = {res}0.0294 {txt}Test that combined OR = 1: Mantel-Haenszel chi2(1) ={res} 8.05 {txt}Pr>chi2 ={res} 0.0046 {txt} {com}. cs chd69 dage, by(arcus) or {txt}arcus senilis {c |}{col 26}OR{col 35}[95% Conf. Interval] M-H Weight {hline 17}{c +}{hline 49} absent {c |} {res} 2.4431 1.745663 3.419325 18.83853{txt} (Cornfield) present {c |} {res} 1.351497 .8957664 2.03919 18.99575{txt} (Cornfield) {hline 17}{c +}{hline 49} Crude {c |} {res} 2.04938 1.58146 2.655782{txt}{col 69} M-H combined {c |} {res} 1.89503 1.457833 2.463341 {txt}{hline 17}{c BT}{hline 49} Test of homogeneity (M-H) chi2({res}1{txt}) ={res} 4.747{txt} Pr>chi2 = {res}0.0294 {txt}Test that combined OR = 1: Mantel-Haenszel chi2(1) ={res} 23.99 {txt}Pr>chi2 ={res} 0.0000 {txt} {com}. . * Logistic model for age-arcus interaction . . logistic chd69 i.arcus##i.dage, coef {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3152 {txt}{col 51}LR chi2({res}3{txt}){col 67}= {res} 40.33 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-865.43251{txt}{col 51}Pseudo R2{col 67}= {res} 0.0228 {txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 1} chd69{col 16}{c |} Coef.{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 9}arcus {c |} {space 6}present {c |}{col 16}{res}{space 2} .6479628{col 28}{space 2} .1788637{col 39}{space 1} 3.62{col 48}{space 3}0.000{col 56}{space 4} .2973964{col 69}{space 3} .9985293 {txt}{space 14} {c |} {space 10}dage {c |} {space 8}50-59 {c |}{col 16}{res}{space 2} .8932677{col 28}{space 2} .1721239{col 39}{space 1} 5.19{col 48}{space 3}0.000{col 56}{space 4} .5559111{col 69}{space 3} 1.230624 {txt}{space 14} {c |} {space 4}arcus#dage {c |} present#50-59 {c |}{col 16}{res}{space 2}-.5920552{col 28}{space 2} .2722269{col 39}{space 1} -2.17{col 48}{space 3}0.030{col 56}{space 4} -1.12561{col 69}{space 3}-.0585002 {txt}{space 14} {c |} {space 9}_cons {c |}{col 16}{res}{space 2}-2.882853{col 28}{space 2} .1089261{col 39}{space 1} -26.47{col 48}{space 3}0.000{col 56}{space 4}-3.096344{col 69}{space 3}-2.669362 {txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. * calculation of OR for arcus effect among the old . display _b[_cons] + _b[1.arcus]*1 + _b[1.dage]*1 + _b[1.arcus#1.dage]*1 {res}-1.9336776 {txt} {com}. display _b[_cons] + _b[1.arcus]*0 + _b[1.dage]*1 + _b[1.arcus#1.dage]*0 {res}-1.9895852 {txt} {com}. * log OR . display _b[1.arcus] + _b[1.arcus#1.dage] {res}.05590763 {txt} {com}. * OR . display exp(_b[1.arcus] + _b[1.arcus#1.dage]) {res}1.0575 {txt} {com}. * With lincom . lincom 1.arcus + 1.arcus#1.dage {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus + [chd69]1.arcus#1.dage = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 1.0575{col 26}{space 2} .2170202{col 37}{space 1} 0.27{col 46}{space 3}0.785{col 54}{space 4} .7072887{col 67}{space 3} 1.581117 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom 1.dage + 1.arcus#1.dage {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.dage + [chd69]1.arcus#1.dage = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 1.351497{col 26}{space 2} .2850372{col 37}{space 1} 1.43{col 46}{space 3}0.153{col 54}{space 4} .8939071{col 67}{space 3} 2.043325 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom 1.arcus {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 1.911643{col 26}{space 2} .3419235{col 37}{space 1} 3.62{col 46}{space 3}0.000{col 54}{space 4} 1.346349{col 67}{space 3} 2.714287 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom 1.dage {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.dage = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 2.4431{col 26}{space 2} .4205159{col 37}{space 1} 5.19{col 46}{space 3}0.000{col 54}{space 4} 1.743529{col 67}{space 3} 3.423366 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom 1.arcus + 1.dage + 1.arcus#1.dage {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus + [chd69]1.dage + [chd69]1.arcus#1.dage = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 2.583578{col 26}{space 2} .4916842{col 37}{space 1} 4.99{col 46}{space 3}0.000{col 54}{space 4} 1.779215{col 67}{space 3} 3.751586 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. . * risk difference regression model . binreg chd69 i.arcus##i.dage, rd {txt}Iteration 1:{col 16}deviance = {res} 1730.865 {txt}Iteration 2:{col 16}deviance = {res} 1730.865 {txt}Generalized linear models{col 52}No. of obs{col 68}={col 70}{res} 3152 {txt}Optimization : {res}MQL Fisher scoring{txt}{col 52}Residual df{col 68}={col 70}{res} 3148 {col 20}(IRLS EIM){txt}{col 52}Scale parameter{col 68}={col 70}{res} 1 {txt}Deviance{col 18}={res}{col 20} 1730.865012{txt}{col 52}(1/df) Deviance{col 68}={res}{col 70} .5498301 {txt}Pearson{col 18}={res}{col 20} 3152{txt}{col 52}(1/df) Pearson{col 68}={res}{col 70} 1.001271 {txt}Variance function: {res}V(u) = {col 27}u*(1-u){col 52}{txt}[{res}Bernoulli{txt}] Link function : {res}g(u) = {col 27}u{col 52}{txt}[{res}Identity{txt}] {col 52}BIC{col 68}={res}{col 70}-23628.77 {txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 16}{c |}{col 28} EIM {col 1} chd69{col 16}{c |} Risk Diff.{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 9}arcus {c |} {space 6}present {c |}{col 16}{res}{space 2} .0436531{col 28}{space 2} .0135409{col 39}{space 1} 3.22{col 48}{space 3}0.001{col 56}{space 4} .0171134{col 69}{space 3} .0701927 {txt}{space 14} {c |} {space 10}dage {c |} {space 8}50-59 {c |}{col 16}{res}{space 2} .067293{col 28}{space 2} .0151269{col 39}{space 1} 4.45{col 48}{space 3}0.000{col 56}{space 4} .0376448{col 69}{space 3} .0969412 {txt}{space 14} {c |} {space 4}arcus#dage {c |} present#50-59 {c |}{col 16}{res}{space 2}-.0376097{col 28}{space 2} .0260577{col 39}{space 1} -1.44{col 48}{space 3}0.149{col 56}{space 4}-.0886819{col 69}{space 3} .0134625 {txt}{space 14} {c |} {space 9}_cons {c |}{col 16}{res}{space 2} .0530077{col 28}{space 2} .0054679{col 39}{space 1} 9.69{col 48}{space 3}0.000{col 56}{space 4} .0422909{col 69}{space 3} .0637246 {txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. . * interaction model with age continuous (and linear) . logistic chd69 i.arcus##c.age, coef {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3152 {txt}{col 51}LR chi2({res}3{txt}){col 67}= {res} 53.33 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-858.93362{txt}{col 51}Pseudo R2{col 67}= {res} 0.0301 {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 7}arcus {c |} {space 4}present {c |}{col 14}{res}{space 2} 2.754185{col 26}{space 2} 1.140118{col 37}{space 1} 2.42{col 46}{space 3}0.016{col 54}{space 4} .5195952{col 67}{space 3} 4.988774 {txt}{space 9}age {c |}{col 14}{res}{space 2} .089647{col 26}{space 2} .0148904{col 37}{space 1} 6.02{col 46}{space 3}0.000{col 54}{space 4} .0604623{col 67}{space 3} .1188317 {txt}{space 12} {c |} {space 1}arcus#c.age {c |} {space 4}present {c |}{col 14}{res}{space 2}-.0498298{col 26}{space 2} .0233431{col 37}{space 1} -2.13{col 46}{space 3}0.033{col 54}{space 4}-.0955814{col 67}{space 3}-.0040782 {txt}{space 12} {c |} {space 7}_cons {c |}{col 14}{res}{space 2}-6.788086{col 26}{space 2} .7179977{col 37}{space 1} -9.45{col 46}{space 3}0.000{col 54}{space 4}-8.195335{col 67}{space 3}-5.380836 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. * OR for the effect of arcus in 55 year-olds . lincom _cons + c.age*55 + 1.arcus + 1.arcus#c.age*55 {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus + 55{res}*{res}[chd69]age + 55{res}*{res}[chd69]1.arcus#c.age + [chd69]_cons = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} .1581902{col 26}{space 2} .0239989{col 37}{space 1} -12.15{col 46}{space 3}0.000{col 54}{space 4} .1175018{col 67}{space 3} .2129682 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom _cons + c.age*55 {p 0 7}{space 1}{text:( 1)}{space 1} {res}55{res}*{res}[chd69]age + [chd69]_cons = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} .1560621{col 26}{space 2} .0211577{col 37}{space 1} -13.70{col 46}{space 3}0.000{col 54}{space 4} .1196459{col 67}{space 3} .2035621 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom 1.arcus + 1.arcus#c.age*55 {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus + 55{res}*{res}[chd69]1.arcus#c.age = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 1.013637{col 26}{space 2} .2062336{col 37}{space 1} 0.07{col 46}{space 3}0.947{col 54}{space 4} .6802954{col 67}{space 3} 1.510313 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. * OR for the effect of arcus in 40 year-olds . lincom _cons + c.age*40 + 1.arcus + 1.arcus#c.age*40 {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus + 40{res}*{res}[chd69]age + 40{res}*{res}[chd69]1.arcus#c.age + [chd69]_cons = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} .0870551{col 26}{space 2} .016688{col 37}{space 1} -12.73{col 46}{space 3}0.000{col 54}{space 4} .0597893{col 67}{space 3} .1267549 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom _cons + c.age*40 {p 0 7}{space 1}{text:( 1)}{space 1} {res}40{res}*{res}[chd69]age + [chd69]_cons = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} .0406724{col 26}{space 2} .005884{col 37}{space 1} -22.13{col 46}{space 3}0.000{col 54}{space 4} .0306307{col 67}{space 3} .054006 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lincom 1.arcus + 1.arcus#c.age*40 {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]1.arcus + 40{res}*{res}[chd69]1.arcus#c.age = 0{p_end} {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 9}(1) {c |}{col 14}{res}{space 2} 2.140398{col 26}{space 2} .5140334{col 37}{space 1} 3.17{col 46}{space 3}0.002{col 54}{space 4} 1.336816{col 67}{space 3} 3.427025 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. * risk difference model . binreg chd69 i.arcus##c.age, rd {txt}Iteration 1:{col 16}deviance = {res} 1721.917 {txt}Iteration 2:{col 16}deviance = {res} 1720.976 {txt}Iteration 3:{col 16}deviance = {res} 1720.929 {txt}Iteration 4:{col 16}deviance = {res} 1720.927 {txt}Iteration 5:{col 16}deviance = {res} 1720.927 {txt}Iteration 6:{col 16}deviance = {res} 1720.927 {txt}Iteration 7:{col 16}deviance = {res} 1720.927 {txt}Generalized linear models{col 52}No. of obs{col 68}={col 70}{res} 3152 {txt}Optimization : {res}MQL Fisher scoring{txt}{col 52}Residual df{col 68}={col 70}{res} 3148 {col 20}(IRLS EIM){txt}{col 52}Scale parameter{col 68}={col 70}{res} 1 {txt}Deviance{col 18}={res}{col 20} 1720.92654{txt}{col 52}(1/df) Deviance{col 68}={res}{col 70} .546673 {txt}Pearson{col 18}={res}{col 20} 3151.956739{txt}{col 52}(1/df) Pearson{col 68}={res}{col 70} 1.001257 {txt}Variance function: {res}V(u) = {col 27}u*(1-u){col 52}{txt}[{res}Bernoulli{txt}] Link function : {res}g(u) = {col 27}u{col 52}{txt}[{res}Identity{txt}] {col 52}BIC{col 68}={res}{col 70}-23638.71 {txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {col 14}{c |}{col 26} EIM {col 1} chd69{col 14}{c |} Risk Diff.{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 7}arcus {c |} {space 4}present {c |}{col 14}{res}{space 2} .0951563{col 26}{space 2} .0945146{col 37}{space 1} 1.01{col 46}{space 3}0.314{col 54}{space 4}-.0900888{col 67}{space 3} .2804015 {txt}{space 9}age {c |}{col 14}{res}{space 2} .005478{col 26}{space 2} .0010767{col 37}{space 1} 5.09{col 46}{space 3}0.000{col 54}{space 4} .0033677{col 67}{space 3} .0075883 {txt}{space 12} {c |} {space 1}arcus#c.age {c |} {space 4}present {c |}{col 14}{res}{space 2}-.0014309{col 26}{space 2} .0020431{col 37}{space 1} -0.70{col 46}{space 3}0.484{col 54}{space 4}-.0054354{col 67}{space 3} .0025735 {txt}{space 12} {c |} {space 7}_cons {c |}{col 14}{res}{space 2} -.180477{col 26}{space 2} .0474075{col 37}{space 1} -3.81{col 46}{space 3}0.000{col 54}{space 4} -.273394{col 67}{space 3}-.0875599 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. * RERI . . * likelihood ratio test example . logistic chd69 chol sbp age i.smoke bmi i.behpat {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3142 {txt}{col 51}LR chi2({res}8{txt}){col 67}= {res} 189.40 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-794.89999{txt}{col 51}Pseudo R2{col 67}= {res} 0.1065 {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.010798{col 26}{space 2} .0015221{col 37}{space 1} 7.13{col 46}{space 3}0.000{col 54}{space 4} 1.007819{col 67}{space 3} 1.013785 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} 1.018203{col 26}{space 2} .0042049{col 37}{space 1} 4.37{col 46}{space 3}0.000{col 54}{space 4} 1.009995{col 67}{space 3} 1.026478 {txt}{space 9}age {c |}{col 14}{res}{space 2} 1.062438{col 26}{space 2} .0127373{col 37}{space 1} 5.05{col 46}{space 3}0.000{col 54}{space 4} 1.037764{col 67}{space 3} 1.087698 {txt}{space 12} {c |} {space 7}smoke {c |} {space 5}smoker {c |}{col 14}{res}{space 2} 1.828109{col 26}{space 2} .257801{col 37}{space 1} 4.28{col 46}{space 3}0.000{col 54}{space 4} 1.386645{col 67}{space 3} 2.410122 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} 1.057105{col 26}{space 2} .0280768{col 37}{space 1} 2.09{col 46}{space 3}0.037{col 54}{space 4} 1.003483{col 67}{space 3} 1.113592 {txt}{space 12} {c |} {space 6}behpat {c |} {space 9}A2 {c |}{col 14}{res}{space 2} 1.069375{col 26}{space 2} .2365875{col 37}{space 1} 0.30{col 46}{space 3}0.762{col 54}{space 4} .6931243{col 67}{space 3} 1.649868 {txt}{space 9}B3 {c |}{col 14}{res}{space 2} .5142782{col 26}{space 2} .1246099{col 37}{space 1} -2.74{col 46}{space 3}0.006{col 54}{space 4} .3198538{col 67}{space 3} .8268844 {txt}{space 9}B4 {c |}{col 14}{res}{space 2} .572301{col 26}{space 2} .1827124{col 37}{space 1} -1.75{col 46}{space 3}0.080{col 54}{space 4} .306105{col 67}{space 3} 1.069987 {txt}{space 12} {c |} {space 7}_cons {c |}{col 14}{res}{space 2} 8.55e-06{col 26}{space 2} 8.65e-06{col 37}{space 1} -11.53{col 46}{space 3}0.000{col 54}{space 4} 1.18e-06{col 67}{space 3} .0000622 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. gen behpat2 = 5 - behpat {txt} {com}. tab behpat behpat2 {txt}behavioral {c |} pattern (4 {c |} behpat2 level) {c |} 1 2 3 4 {c |} Total {hline 11}{c +}{hline 44}{c +}{hline 10} A1 {c |}{res} 0 0 0 264 {txt}{c |}{res} 264 {txt} A2 {c |}{res} 0 0 1,325 0 {txt}{c |}{res} 1,325 {txt} B3 {c |}{res} 0 1,216 0 0 {txt}{c |}{res} 1,216 {txt} B4 {c |}{res} 349 0 0 0 {txt}{c |}{res} 349 {txt}{hline 11}{c +}{hline 44}{c +}{hline 10} Total {c |}{res} 349 1,216 1,325 264 {txt}{c |}{res} 3,154 {txt} {com}. logistic chd69 chol sbp age i.smoke bmi i.behpat2 {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3142 {txt}{col 51}LR chi2({res}8{txt}){col 67}= {res} 189.40 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-794.89999{txt}{col 51}Pseudo R2{col 67}= {res} 0.1065 {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.010798{col 26}{space 2} .0015221{col 37}{space 1} 7.13{col 46}{space 3}0.000{col 54}{space 4} 1.007819{col 67}{space 3} 1.013785 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} 1.018203{col 26}{space 2} .0042049{col 37}{space 1} 4.37{col 46}{space 3}0.000{col 54}{space 4} 1.009995{col 67}{space 3} 1.026478 {txt}{space 9}age {c |}{col 14}{res}{space 2} 1.062438{col 26}{space 2} .0127373{col 37}{space 1} 5.05{col 46}{space 3}0.000{col 54}{space 4} 1.037764{col 67}{space 3} 1.087698 {txt}{space 12} {c |} {space 7}smoke {c |} {space 5}smoker {c |}{col 14}{res}{space 2} 1.828109{col 26}{space 2} .257801{col 37}{space 1} 4.28{col 46}{space 3}0.000{col 54}{space 4} 1.386645{col 67}{space 3} 2.410122 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} 1.057105{col 26}{space 2} .0280768{col 37}{space 1} 2.09{col 46}{space 3}0.037{col 54}{space 4} 1.003483{col 67}{space 3} 1.113592 {txt}{space 12} {c |} {space 5}behpat2 {c |} {space 10}2 {c |}{col 14}{res}{space 2} .898615{col 26}{space 2} .252463{col 37}{space 1} -0.38{col 46}{space 3}0.704{col 54}{space 4} .5181212{col 67}{space 3} 1.558533 {txt}{space 10}3 {c |}{col 14}{res}{space 2} 1.868554{col 26}{space 2} .4926845{col 37}{space 1} 2.37{col 46}{space 3}0.018{col 54}{space 4} 1.114469{col 67}{space 3} 3.132877 {txt}{space 10}4 {c |}{col 14}{res}{space 2} 1.747332{col 26}{space 2} .5578522{col 37}{space 1} 1.75{col 46}{space 3}0.080{col 54}{space 4} .9345907{col 67}{space 3} 3.266853 {txt}{space 12} {c |} {space 7}_cons {c |}{col 14}{res}{space 2} 4.89e-06{col 26}{space 2} 4.89e-06{col 37}{space 1} -12.23{col 46}{space 3}0.000{col 54}{space 4} 6.89e-07{col 67}{space 3} .0000347 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. estimates store A1 {txt} {com}. logistic chd69 chol sbp age i.smoke bmi {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3142 {txt}{col 51}LR chi2({res}5{txt}){col 67}= {res} 164.59 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-807.30676{txt}{col 51}Pseudo R2{col 67}= {res} 0.0925 {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.010898{col 26}{space 2} .0015077{col 37}{space 1} 7.27{col 46}{space 3}0.000{col 54}{space 4} 1.007947{col 67}{space 3} 1.013857 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} 1.019492{col 26}{space 2} .0041708{col 37}{space 1} 4.72{col 46}{space 3}0.000{col 54}{space 4} 1.011351{col 67}{space 3} 1.0277 {txt}{space 9}age {c |}{col 14}{res}{space 2} 1.066472{col 26}{space 2} .0126965{col 37}{space 1} 5.41{col 46}{space 3}0.000{col 54}{space 4} 1.041875{col 67}{space 3} 1.091649 {txt}{space 12} {c |} {space 7}smoke {c |} {space 5}smoker {c |}{col 14}{res}{space 2} 1.882673{col 26}{space 2} .2637221{col 37}{space 1} 4.52{col 46}{space 3}0.000{col 54}{space 4} 1.430671{col 67}{space 3} 2.477479 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} 1.059366{col 26}{space 2} .0279143{col 37}{space 1} 2.19{col 46}{space 3}0.029{col 54}{space 4} 1.006044{col 67}{space 3} 1.115514 {txt}{space 7}_cons {c |}{col 14}{res}{space 2} 4.39e-06{col 26}{space 2} 4.28e-06{col 37}{space 1} -12.65{col 46}{space 3}0.000{col 54}{space 4} 6.49e-07{col 67}{space 3} .0000297 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lrtest A1 {txt}Likelihood-ratio test{col 55}LR chi2({res}3{txt}){col 67}={res} 24.81 {txt}(Assumption: {res}{stata est replay .:.}{txt} nested in {res}{stata est replay A1:A1}{txt}){col 55}Prob > chi2 = {res} 0.0000 {txt} {com}. * using testparm . quietly logistic chd69 chol sbp age i.smoke bmi i.behpat2 {txt} {com}. testparm i.behpat2 {p 0 7}{space 1}{text:( 1)}{space 1} {res}[chd69]2.behpat2 = 0{p_end} {p 0 7}{space 1}{text:( 2)}{space 1} [chd69]3.behpat2 = 0{p_end} {p 0 7}{space 1}{text:( 3)}{space 1} [chd69]4.behpat2 = 0{p_end} {txt}{col 12}chi2( 3) ={res} 23.51 {txt}{col 10}Prob > chi2 = {res} 0.0000 {txt} {com}. # evaluating dichotmizing behavior pattern {err}Unknown #command {com}. logistic chd69 chol sbp age 1.smoke bmi 1.dibpat {res} {txt}Logistic regression{col 51}Number of obs{col 67}= {res} 3142 {txt}{col 51}LR chi2({res}6{txt}){col 67}= {res} 189.16 {txt}{col 51}Prob > chi2{col 67}= {res} 0.0000 {txt}Log likelihood = {res}-795.01767{txt}{col 51}Pseudo R2{col 67}= {res} 0.1063 {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.010779{col 26}{space 2} .0015212{col 37}{space 1} 7.12{col 46}{space 3}0.000{col 54}{space 4} 1.007802{col 67}{space 3} 1.013765 {txt}{space 9}sbp {c |}{col 14}{res}{space 2} 1.018241{col 26}{space 2} .0041957{col 37}{space 1} 4.39{col 46}{space 3}0.000{col 54}{space 4} 1.010051{col 67}{space 3} 1.026498 {txt}{space 9}age {c |}{col 14}{res}{space 2} 1.06223{col 26}{space 2} .012712{col 37}{space 1} 5.04{col 46}{space 3}0.000{col 54}{space 4} 1.037605{col 67}{space 3} 1.08744 {txt}{space 12} {c |} {space 7}smoke {c |} {space 5}smoker {c |}{col 14}{res}{space 2} 1.826545{col 26}{space 2} .2575497{col 37}{space 1} 4.27{col 46}{space 3}0.000{col 54}{space 4} 1.385504{col 67}{space 3} 2.407981 {txt}{space 9}bmi {c |}{col 14}{res}{space 2} 1.056673{col 26}{space 2} .0280322{col 37}{space 1} 2.08{col 46}{space 3}0.038{col 54}{space 4} 1.003135{col 67}{space 3} 1.113069 {txt}{space 12} {c |} {space 6}dibpat {c |} {space 6}A1,A2 {c |}{col 14}{res}{space 2} 2.008081{col 26}{space 2} .2899056{col 37}{space 1} 4.83{col 46}{space 3}0.000{col 54}{space 4} 1.513191{col 67}{space 3} 2.664826 {txt}{space 7}_cons {c |}{col 14}{res}{space 2} 4.59e-06{col 26}{space 2} 4.50e-06{col 37}{space 1} -12.54{col 46}{space 3}0.000{col 54}{space 4} 6.72e-07{col 67}{space 3} .0000313 {txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12} {com}. lrtest A1 {txt}Likelihood-ratio test{col 55}LR chi2({res}2{txt}){col 67}={res} 0.24 {txt}(Assumption: {res}{stata est replay .:.}{txt} nested in {res}{stata est replay A1:A1}{txt}){col 55}Prob > chi2 = {res} 0.8890 {txt} {com}. . log close {txt}name: {res} {txt}log: {res}/Users/steve/Documents/teaching/c2015/biostat208/labs/lab9/lab9.smcl {txt}log type: {res}smcl {txt}closed on: {res} 3 Mar 2015, 15:15:54 {txt}{.-} {smcl} {txt}{sf}{ul off}