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, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Amal Khanolkar <Amal.Khanolkar@ki.se> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
FW: st: Plotting several linear associations in one graph for comparison |

Date |
Mon, 16 Jul 2012 10:12:24 +0000 |

Hello all, Regarding my previous question: plotting multiple linear regressions stratified by a particular variable on the same graph. I received some example syntax from Maarten but I was unable to understand the details. Does anybody else have any ideas on how twoway line plot can be exploited for my prupose? My original Q: - 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. Thanks! Amal. ________________________________________ From: Amal Khanolkar Sent: 13 July 2012 15:22 To: statalist@hsphsun2.harvard.edu Subject: RE: st: Plotting several linear associations in one graph for comparison 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: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Maarten Buis [maartenlbuis@gmail.com] Sent: 13 July 2012 15:10 To: statalist@hsphsun2.harvard.edu 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/

**Follow-Ups**:**Re: FW: st: Plotting several linear associations in one graph for comparison***From:*Nick Cox <njcoxstata@gmail.com>

**Re: FW: st: Plotting several linear associations in one graph for comparison***From:*Maarten Buis <maartenlbuis@gmail.com>

**References**:**st: Plotting several linear associations in one graph for comparison***From:*Amal Khanolkar <Amal.Khanolkar@ki.se>

**Re: st: Plotting several linear associations in one graph for comparison***From:*Maarten Buis <maartenlbuis@gmail.com>

**RE: st: Plotting several linear associations in one graph for comparison***From:*Amal Khanolkar <Amal.Khanolkar@ki.se>

- Prev by Date:
**Re: FW: st: Plotting several linear associations in one graph for comparison** - Next by Date:
**Re: FW: st: Plotting several linear associations in one graph for comparison** - Previous by thread:
**RE: st: Plotting several linear associations in one graph for comparison** - Next by thread:
**Re: FW: st: Plotting several linear associations in one graph for comparison** - Index(es):