* do "~/Documents/teaching/c2015/biostat208/labs/lab9/lab9.do" cd "~/Documents/teaching/c2015/biostat208/labs/lab9/" use lab9, clear log using "lab9", replace * smoking indicator gen smoke = ncig recode smoke 0 = 0 1/max = 1 label define smlab 0 "nonsmoker" 1 "smoker" label val smoke smlab * adjusted assoc. between CHD & type A behavior * using cs cs chd69 dibpat, by(smoke) or * using logistic regression logistic chd69 i.dibpat i.smoke * binary version of age gen dage = age recode dage 39/49=0 50/59=1 label define dagelab 0 "39-49" 1 "50-59" label val dage dagelab * Assoc. between CHD, age & arcus cs chd69 arcus, or cs chd69 dage, or cs chd69 arcus, by(dage) or cs chd69 dage, by(arcus) or * Logistic model for age-arcus interaction logistic chd69 i.arcus##i.dage, coef * 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 display _b[_cons] + _b[1.arcus]*0 + _b[1.dage]*1 + _b[1.arcus#1.dage]*0 * log OR display _b[1.arcus] + _b[1.arcus#1.dage] * OR display exp(_b[1.arcus] + _b[1.arcus#1.dage]) * With lincom lincom 1.arcus + 1.arcus#1.dage lincom 1.dage + 1.arcus#1.dage lincom 1.arcus lincom 1.dage lincom 1.arcus + 1.dage + 1.arcus#1.dage * risk difference regression model binreg chd69 i.arcus##i.dage, rd * interaction model with age continuous (and linear) logistic chd69 i.arcus##c.age, coef * OR for the effect of arcus in 55 year-olds lincom _cons + c.age*55 + 1.arcus + 1.arcus#c.age*55 lincom _cons + c.age*55 lincom 1.arcus + 1.arcus#c.age*55 * OR for the effect of arcus in 40 year-olds lincom _cons + c.age*40 + 1.arcus + 1.arcus#c.age*40 lincom _cons + c.age*40 lincom 1.arcus + 1.arcus#c.age*40 * risk difference model binreg chd69 i.arcus##c.age, rd * RERI * likelihood ratio test example logistic chd69 chol sbp age i.smoke bmi i.behpat gen behpat2 = 5 - behpat tab behpat behpat2 logistic chd69 chol sbp age i.smoke bmi i.behpat2 estimates store A1 logistic chd69 chol sbp age i.smoke bmi lrtest A1 * using testparm quietly logistic chd69 chol sbp age i.smoke bmi i.behpat2 testparm i.behpat2 # evaluating dichotmizing behavior pattern logistic chd69 chol sbp age 1.smoke bmi 1.dibpat lrtest A1 log close