Statalist


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

Re: st: Plotting several polynomials on the same graph


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Plotting several polynomials on the same graph
Date   Fri, 17 Jul 2009 08:23:33 +0000 (GMT)

--- On Fri, 17/7/09, Miranda Kim <[email protected]> wrote:
> I have three variables that hold coefficients for
> polynomials (such that each row contains three coefficients
> for a simple polynomial y=a+bx+cx^2). I want to draw all
> polynomials (10 rows) on the same graph.
> 
> Then (if possible) I have three variables that hold three
> points that lie on the graph (each row contains three points
> that lie on the polynomial that is defined by the
> coefficients on that row), I’d like to plot these too (on
> the same graph).

Does this solve your first question?

*-------------- begin example -------------------
input a b c
1 2 3
2 3 4
end

twoway function y = a[1] + b[1]*x + c[1]*x^2, ///
       range(-3 3) || ///
       function y = a[2] + b[2]*x + c[2]*x^2, /// 
       range(-3 3) 
*---------------- end example -------------------

I don't understand the data structure involved in 
your second question: a point on that curve should
be defined by two values: and x coordinate and a 
y coordinate. If you have those you can use
-scatter- as an overlay plot within the example
I gave above. You could also consider the 
-xline()- or -yline()- options.

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/



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