Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: 5 regression lines on one twoway


From   "Alan Neustadtl" <alan.neustadtl@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: 5 regression lines on one twoway
Date   Sun, 20 May 2007 11:10:31 -0400

Here is an example that may do what you want.  Obviously you can play
with it to make it look the way you want it to look.

sysuse auto, clear
graph twoway (scatter price weight)             ///
            (lfit price weight)                ///
            (scatter price weight if rep78==1) ///
            (lfit price weight if rep78==1)    ///
            (scatter price weight if rep78==2) ///
            (lfit price weight if rep78==2)    ///
            (scatter price weight if rep78==3) ///
            (lfit price weight if rep78==4)    ///
            (scatter price weight if rep78==5) ///
            (lfit price weight if rep78==5)

Best,
Alan

On 5/20/07, cbaylor@ucla.edu <cbaylor@ucla.edu> wrote:
I would like to do a twoway regress plot of vote for incumbent
president against real disposable income.  However, I would like to
show the regression line not only for the sample as a whole, but for
four exclusive subsets of the data.  Does anyone know how to do this?

Thanks ahead of time,

Chris
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index