Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: graph with two trend lines


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   Re: st: graph with two trend lines
Date   Fri, 2 Aug 2002 11:56:33 +0100

Hans J. Baumgartner wrote

I would like to draw a graph that shows all data point and (i) a trend
line over all data points and (ii) a trend line over selected data
points.

reg x1 x2
predict yhat1
graph yhat1 x1 x2, connect (l.) symbol(i[x3]) trim (3)

This shows the desired graph with one trend line over all data points.

reg x1 x2 if x4==1
predict yhat2

yhat2 shall be the second trend line over selected data points (x4 is
a
dummy)

How has the graph command to look like?

>>> Just add in the new variable:

gra x1 yhat1 yhat2 x2, c(.ll) sy([x3]ii) trim(3) sort

Defining some variable labels beforehand will also help.

Nick
n.j.cox@durham.ac.uk

*
*   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