Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[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'" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: how to generate mean for a secquence of five year of a variable |

Date |
Thu, 5 May 2011 15:48:11 +0100 |

As I understand, that reduces the data. You'd need to -expand- and -merge- back. For blocks, you just round the time variable and fire up -egen-'s -mean()-. I just gave an example in another thread. Nick n.j.cox@durham.ac.uk Oliver Jones I have never used -rolling- and just had a quick look at the help file of it. Couldn't -rolling- be used for both possibilities, i.e. calculating the mean for separate blocks of five years and moving blocks, by specifying the stepsize(5) option? Am 05.05.2011 16:23, schrieb Nick Cox: > If that's the right diagnosis: > > -rolling- > > -mvsumm- (SSC) Oliver Jones > ok, now I got it. You want some kind of running-mean. > The function -lowess- has an option to create a new > variable that is a running mean. > BUT, this is not exactly what we want here, because this > mean is calculated at the center of the running window. > We want the mean at the right end of the window. > > Am 05.05.2011 15:53, schrieb prakash singh: > >> yearid countryid var1 var2 >> 1980 1 7.25 >> 1981 1 8.25 >> 1982 1 9.5 >> 1983 1 7.5 >> 1984 1 7.75 8.05 (mean of first five observation of var1) >> ........................................... >> ........................................ >> 2001 1 8.25 >> 2002 1 9 >> 2003 1 9.5 >> 2004 1 8 >> 2005 1 10 8.95 (mean of last five observation of var1) >> >> similarly for all other country. * * 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**:**st: how to generate mean for a secquence of five year of a variable***From:*prakash singh <prakashbhu@gmail.com>

**Re: st: how to generate mean for a secquence of five year of a variable***From:*Oliver Jones <ojones@wiwi.uni-bielefeld.de>

**Re: st: how to generate mean for a secquence of five year of a variable***From:*prakash singh <prakashbhu@gmail.com>

**Re: st: how to generate mean for a secquence of five year of a variable***From:*Oliver Jones <ojones@wiwi.uni-bielefeld.de>

**RE: st: how to generate mean for a secquence of five year of a variable***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: how to generate mean for a secquence of five year of a variable***From:*Oliver Jones <ojones@wiwi.uni-bielefeld.de>

- Prev by Date:
**Re: st: how to generate mean for a secquence of five year of a variable** - Next by Date:
**st: Unable to contact host** - Previous by thread:
**Re: st: how to generate mean for a secquence of five year of a variable** - Next by thread:
**Re: st: how to generate mean for a secquence of five year of a variable** - Index(es):