Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[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 <>
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
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
*--------------- end example -------------------
(For more on examples I sent to the Statalist see: )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index