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.
Related Posts with linear regression
Opposite signs of average marginal effects after probitHello everyone A probit regression generated the following output Probit regression Number of obs…
atmeans vs vce(unconditional)Analyzing a publicly available svy dataset. Need to know the differences/when to use margins with at…
What is wrong with the code foreach here?I have the code foreach, I do not know while it work in one case and does not work in another case. …
Trouble replacing values with foreach loopHi I'm trying to discard entry errors from a question response (q_text in example) with the unique i…
Creating a boxplot that connects across timeHello, I am not sure if what I am looking to do is at all possible so I am going to post my idea bu…
Subscribe to:
Post Comments (Atom)
0 Response to linear regression
Post a Comment