cd "/Users/steve/Documents/teaching/c2014/biostat208/labs/lab3/" * do "/Users/steve/Documents/teaching/c2014/biostat208/labs/lab3/lab3.do" log using lab3, replace use lab3, clear tab physact, sum(bmi) reg bmi i.physact * compute mean BMI at each level of physact forvalues i = 2/5 { lincom _cons + `i'.physact } margins physact * test for heterogeneity testparm i.physact * test for linear trend contrast q(1).physact, noeffects * test for departure from linear trend contrast q(2/4).physact, noeffects * repeat with adjustment for age, smoking, and alcohol use reg bmi i.physact age10 smoking drnkspwk * compute mean BMI at each level of physact margins physact, atmeans * test for heterogeneity testparm i.physact * test for linear trend contrast q(1).physact, noeffects * test for departure from linear trend contrast q(2/4).physact, noeffects * models using log of creatinine level as outcome and predictor regress lncreat bmi age, eform("exp(beta)") nlcom 100*(exp(_b[bmi])-1) regress sbp lncreat age diabetes nlcom _b[lncreat]*log(1.25) log close