window push log using FramSBPbmiSex.log, replace window push * FramSBPbmiSex.log window push * window push * Regression of systolic blood pressure against body mass window push * index at baseline in men and women from the Framingham Heart Study. window push * window push set more on window push use "2.20.Framingham.dta", clear window push codebook sex window push regress sbp bmi if sex == 1 window push predict yhatmen, xb window push regress sbp bmi if sex == 2 window push predict yhatwom, xb window push sort bmi window push * window push * Scatter plot with expected sbp for women window push * window push scatter sbp bmi if sex==2 , msymbol(Oh) /// window push || lfit sbp bmi if sex==2 /// window push , lpattern(dash) xlabel(15 (15) 60) /// window push ylabel( 100 (50) 250 ) ytitle(Systolic Blood Pressure) window push more window push * window push * Scatter plot with expected sbp for men window push * window push scatter sbp bmi if sex==1 , msymbol(Oh) /// window push || lfit sbp bmi if sex==1 /// window push , xlabel(15 (15) 60) /// window push ylabel( 100 (50) 250 ) ytitle(Systolic Blood Pressure) window push more window push * window push * Combining the previous two graphs with a by(sex) option and adding window push * some formatting gives gives the following figure window push * window push scatter sbp bmi , msymbol(Oh) mcolor(gs10) /// window push || line yhatmen bmi if sex == 1, lwidth(medthick) /// window push || line yhatwom bmi, lwidth(medthick) lpattern(dash) /// window push ||, by(sex) ytitle(Systolic Blood Pressure) xsize(8) /// window push ylabel( 100 (50) 250) ymtick(75 (25) 225) /// window push xtitle(Body Mass Index) xlabel( 15 (15) 60) xmtick(20 (5) 55) /// window push legend(order(1 "Observed" 2 "Expected, Men" 3 /// window push "Expected, Women") rows(1)) window push log close