Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Plotting several linear associations in one graph for comparison
From
Maarten Buis <[email protected]>
To
[email protected]
Subject
Re: st: Plotting several linear associations in one graph for comparison
Date
Fri, 13 Jul 2012 15:10:21 +0200
On Fri, Jul 13, 2012 at 2:42 PM, Amal Khanolkar wrote:
> - I've run some very basic and simple linear regression models to analyse associations between standardized birth weight and blood pressure, adjusting for confounders like birth year, current age, BMI, height etc.
>
> - The associations between birth weight and blood pressure are stratified by ethnicity (12 ethnic goups - thus 12 separate linear regression models). I see that the association between birth weight and blood pressure does differ in the various ethnic goups.
>
> - I would now like to plot the above associations in a single graph using different colours for the various ethnic groups for comparison.
*---------------- begin example ----------------
sysuse nlsw88, clear
reg wage i.race##c.grade i.union hours ttl_exp
preserve
replace union = 1
replace hours = 40
replace ttl_exp = 15
bys race grade : keep if _n == 1
predict yhat
separate yhat, by(race)
twoway line yhat1 yhat2 yhat3 grade
restore
*--------------- end example -------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/