Hello great statisticians,
I am a bit confused with using lfit vs predicted values. I have the data below and my codes: sbp bmi and women are 3 variables.
use http://www.stats4life.se/data/fhs, clear
regress sbp bmi women
predict predicted_sbp1
twoway (lfit sbp bmi if women==1, lcolor(red)) (lfit sbp bmi if women==0, lcolor(blue)), ytitle(Predicted SBP) xtitle(BMI kg/m2) legend(on order(1 "Women" 2 "Men")) scheme(s1color)
twoway (connected predicted_sbp1 bmi if women==1, lcolor(maroon) mcolor(maroon) msize(tiny) msymbol(point)) ///
(connected predicted_sbp1 bmi if women==0, lcolor(green) mcolor(green) msize(tiny) msymbol(point)), ///
ytitle(Predicted mean SBP) xtitle(BMI kg/m2) ///
legend(on order(1 "Women" 2 "Men")) scheme(s1color)
Why do these two graphs are different in shapes? Shouldn't they be the same.
May be I have not understood the logic of regression. Can someone help me to clarify this? Please.
0 Response to linear regression
Post a Comment