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
Amal Khanolkar <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: Plotting several linear associations in one graph for comparison
Date
Fri, 13 Jul 2012 13:22:39 +0000
Hi Maarten,
Thanks for your example.
Just wondering what the 'replace' commands are doing specifically? I guess it's not important for me.
Ideally, I ran my regressions stratifying by race, (if race==1 and so on) - should I also predict yhat separately for each racial group as well?
Thanks,
/Amal.
________________________________________
From: [email protected] [[email protected]] on behalf of Maarten Buis [[email protected]]
Sent: 13 July 2012 15:10
To: [email protected]
Subject: Re: st: Plotting several linear associations in one graph for comparison
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/
*
* 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/