Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: scatter plot with lines laid on


From   Jian Zhang <[email protected]>
To   [email protected]
Subject   Re: st: scatter plot with lines laid on
Date   Mon, 21 Mar 2011 17:42:48 +0800

It really helps.  thanks, Maarten!

Jian

On Mon, Mar 21, 2011 at 4:51 PM, Maarten buis <[email protected]> wrote:
> --- On Mon, 21/3/11, Jian Zhang wrote:
>> Hi all, I was graphing a scatter plot with a number of
>> values for x in the x-axis.  What I'd like to do is to lay
>> on the scatter plot three lines: one line connecting the


>> means of y at each value of x and two lines connecting the
>> one standard deviation above and below the means of y at
>> each value of x, respectively. Does anyone know how to do
>> this?
>
> What about this:
>
> *--------------- begin example --------------
> sysuse auto, clear
>
> bys rep78: egen m = mean(price)
> bys rep78: egen sd = sd(price)
> gen lb = m - sd
> gen ub = m + sd
>
> twoway rarea lb ub rep78, astyle(ci) || ///
>       line m rep78, lstyle(p1)      || ///
>       scatter price rep78, msymbol(Oh)
> *-------------- end example -----------------
> (For more on examples I sent to the Statalist see:
> http://www.maartenbuis.nl/example_faq )
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   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/
>



-- 
Jian Zhang(张舰)
Assistant Professor
School of Economics
Central University of Finance and Economics, Beijing, China 100081
Email: [email protected]
Cell Phone: 86 - 137 188 65377
Web Page: http://econ.cufe.edu.cn/zhang

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index