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

Re: st: RE: Help with Graphs


From   Daniel Egan <[email protected]>
To   [email protected]
Subject   Re: st: RE: Help with Graphs
Date   Wed, 22 Dec 2004 10:04:49 -0500

Another way to understand how to make the graph, and perhaps more
involved, is to understand how they got to the equations. Basically,
using the regressions and -predict-, you can create the predicted
values, and graph all of them. I believe this would get around the
problem with two equations for the switching regression.

(once the dataset is in memory)

*-------------begin code----------
gen erc2=erc*erc
reg q erc erc2
regplot 

predict quadratic
twoway (scatter q erc) (connected quad erc)
-------end code--------------

then do the same for the switching regression - i.e. run the
regression, generate the predicted values, and if you want, twoway
plot them against the actual data.

once you have both predicted values, you can:

twoway (scatter q erc) (connected quad erc) (connected switchr erc)

where quad are your predicted quadradic values, and switchr are your
predicted switching regime values.


Dan

Cameron said: 

 1. How to make the line style for the "regime switching" regression the
same. At the moment it is solid in the positive sloping region and
dashed in the negative.

 2. At the moment the graph produces 4 legend entries. I will want to
 reduce these to just two. I expect the only tricky one will be
 preventing the RW regression showing up twice as it does now.
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index