[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Miranda Kim <mk@mrc.soton.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Plotting several polynomials on the same graph |

Date |
Mon, 20 Jul 2009 09:04:16 +0100 |

Thank you so much for your help with this! Maarten buis wrote:

--- Miranda wrote:I wondered if there is any way of adding functions onto the same graphusing a separate command (on a separate line), so as to be able to loopover these and superimpose several (i.e. instead of using the '||' inthe 'twoway' command)The trick is to create the graph command in a loop while storing it in a local macro, like in the example below: *---------------- begin example ------------------- input a b c 1 2 3 2 3 4 1 2 -3 2 3 -4 end forvalues i = 1/4 { local gr "`gr' function y = a[`i'] + b[`i']*x + c[`i']*x^2" local gr "`gr', range(-3 3) ||" } twoway `gr' *--------------- end example ---------------------- Hope this helps, Maarten ----------------------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://home.fsw.vu.nl/m.buis/ -----------------------------------------* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**RE: Re: st: Plotting several polynomials on the same graph***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**st: AW: dummies from categorical variable** - Next by Date:
**Re: st: AW: how to reply to a posting?** - Previous by thread:
**RE: Re: st: Plotting several polynomials on the same graph** - Next by thread:
**RE: Re: st: Plotting several polynomials on the same graph** - Index(es):

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