Statalist


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

Re: st: RE: Graphics with averages of variables (over other variables)


From   oezguer.guererk@uni-erfurt.de
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Graphics with averages of variables (over other variables)
Date   Wed, 10 Jun 2009 13:15:23 +0200

Nick, this works! Thank you very much!

Nick Cox schrieb:
The code you tried is undoubtedly wrong. It is quite inconsistent with
the syntax specification. Some parts of the -graph- syntax allow data
reduction on the fly, but not the -twoway- command.
There are various ways to approach this. One of the easiest is to
calculate your averages in advance. -egen mean()- in conjunction with
-by:- or a -by()- option is in turn a convenient way to do that. In your
case, the syntax sounds like bysort group period: egen mean = mean(myredpts)
to be followed by a call to a graphics command. I think you should check
out -tsline- or -xtline-. Nick n.j.cox@durham.ac.uk
oezguer.guererk@uni-erfurt.de

I would like to create "twoway connected" graphics of a variable called "myredpts" on the Y-axis and the variable "period" on the X-axis. "myredpts", however, should be averaged over several "subjects" belonging to the same "group", for each "period".

I use the command: "twoway (connected mean(myredpts) period) if treatment == 1, by(group)" which is apparently wrong because of the "mean"... If I skip mean and use only "twoway (connected myredpts period) if treatment == 1, by(group)" then stata draws in each period several points for several subjects and connects them, I, however, want Stata to draw only one single data point for each group consisting of 4 subjects in each period and connect these for the consecutive 20
periods.

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

--
Dr. Özgür Gürerk

Lehrstuhl für Mikroökonomie & Laboratorium für experimentelle Wirtschaftsforschung
(Microeconomics & Laboratory for Experimental Economics)

Universität Erfurt, Nordhäuser Str. 63, D-99089 Erfurt
Tel: +49 361 7374561
Fax: +49 361 7374569
www.uni-erfurt.de/elab
--

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index