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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Wed, 10 Jun 2009 12:05:03 +0100 |

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/

**Follow-Ups**:**Re: st: RE: Graphics with averages of variables (over other variables)***From:*oezguer.guererk@uni-erfurt.de

**References**:**st: Graphics with averages of variables (over other variables)***From:*oezguer.guererk@uni-erfurt.de

- Prev by Date:
**st: AW: Graphics with averages of variables (over other variables)** - Next by Date:
**st: AW: AW: Graphics with averages of variables (over other variables)** - Previous by thread:
**st: AW: AW: Graphics with averages of variables (over other variables)** - Next by thread:
**Re: st: RE: Graphics with averages of variables (over other variables)** - Index(es):

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