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

Re: st: RE: Help with Graphs


From   Cameron Hooper <[email protected]>
To   [email protected]
Subject   Re: st: RE: Help with Graphs
Date   Tue, 21 Dec 2004 23:44:58 -0500

Thanks Scott. I've run your code and the graph is starting to take shape. I will read the sections of [G] you recommend. Looking at the graph so far my main issues will be:

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.

But I should do some reading first myself :-) Thanks again.

Cameron

Scott Merryman wrote:

The basic graph can be made up two commands: -twoway function- and -twoway
scatter-
twoway function y = 0.35299 + 0.692*x, range(0 .461) || /// function y = 0.96888 - 0.644*x, range(.461 1) || /// function y = 0.316 + 1.248*x - 1.301*x^2 , range(0 1) ///
|| scatter q erc

For more info see
[G] graph twoway function
[G] graph twoway qfit
[G] graph twoway lfit
[G] graph twoway scatter

I would also recommend "A Visual Guide to Stata Graphics"
(http://www.stata-press.com/books/vgsg.html)

The graph could refined by changing the line color, marker style, the
legend, ....


Hope this helps,
Scott



-----Original Message-----
From: [email protected] [mailto:owner-
[email protected]] On Behalf Of Cameron Hooper
Sent: Tuesday, December 21, 2004 8:31 PM
To: [email protected]
Subject: st: Help with Graphs

Hi

I am new to Stata and am looking for some help with graphs. I've looked
at the Users/Getting Started Guides and I'm okay with the basics.
However, I'm having trouble making the step to more advanced graphs. I
have access to the Graphics Manual, but it's more of a reference than an
guide. I'll get it with time, but I'm hoping to get up to speed with
graphs reasonably quickly.

Would anyone be willing to show me how to use STATA to create the graph
at the link given below? I realize this might be an unreasonable
request. If so, no worries, just ignore me. But if anyone could help me
out, I'd be grateful. The graph is reasonably complex so examining the
code needed to produce it will teach me a lot in a short period of time.

The example graph is available at:

http://www-personal.umich.edu/~chooper/stata/portfolio_plot.pdf

The data used to generate the plot is available at:

http://www-personal.umich.edu/~chooper/stata/testdata.dta

The x-axis variable is "erc", the y-axis variable is "q"

The line labeled Quadratic regression is the function:

f(x) = 0.316 + 1.248*x - 1.301*x**2 (0 <= x <= 1)

The line labeled Regime Switching regression is the function:

         |  0.35299 + 0.692*x if 0 <= x <= 0.461
  g(x) = |
         |  0.96888 - 0.644*x if 0.461 < x <= 1

Despite the appearance of the pdf I want the plot to be in black and
white. If it matters, I will be saving the graph as a png file for
importing into a LaTeX document. (I use pdflatex so eps files won't work
without conversion.)

If you read this far then thanks! I hope you can help me out.

Cameron



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


--
Cameron Hooper <[email protected]>
University of Michigan Business School
701 Tappan St., Ann Arbor, MI 48109
phone: 734-615-4178 fax: 734-936-0282
Public Key: http://wwwkeys.pgp.net:11371/pks/lookup?op=index&search=0xFCCF8C91
*
* 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