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

st: RE: Help with Graphs


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Help with Graphs
Date   Tue, 21 Dec 2004 22:10:43 -0600

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/



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