set more off use "/Users/dave/Desktop/lab3.dta", clear /* Section 2 */ ttest LDL, by(drinkany) /* Section 3 */ logistic drinkany smoking nonwhite age BMI predict out, p xtile group = out, nq(5) /* Section 4 */ tabulate drinkany group, col table drinkany group, c(mean LDL) /* Section 5 */ reg LDL i.drinkany i.group margins drinkany margins, dydx(drinkany) /* Section 6 */ xtile group20 = out, nq(20) reg LDL i.drinkany i.group20 margins drinkany /* Section 7 */ reg LDL i.drinkany smoking nonwhite age BMI margins drinkany /* Section 8 */ mkspline agesp = age, nknots(5) cubic mkspline bmisp = BMI, nknots(5) cubic logit drinkany smoking nonwhite smoking##c.agesp* smoking##c.bmisp* nonwhite##c.agesp* nonwhite##c.bmisp* predict outsp, p xtile groupsp = out, nq(5) reg LDL i. drinkany i.group margins drinkany