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
runby: requirements for group variable?** This post references a previous forum discussion (https://www.statalist.org/forums/node/1484556) …
Creating a variable that identifies and calculates overlapping time periodsHi everyone, I am currently working on data that shows if respondents of a survey worked part time …
Iv-ppmlI am trying to implement IV-PPML in stata and fairly new to this command. I am using the “ivpoisson”…
Using a loop to compare observations of a variableHi All, I have a dataset which looks something like below: ID Amount month max_amount max_month N…
Kaplan Meier risk table problemDear Statalist, I am using Stata 14.2 on Mac. I have created a propensity score IPT weighted sample…
Subscribe to:
Post Comments (Atom)
0 Response to linear regression
Post a Comment