Bookmark and Share

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, is already up and running.

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

RE: st: Calculating SD of a variable

From   Nick Cox <>
To   "''" <>
Subject   RE: st: Calculating SD of a variable
Date   Fri, 20 May 2011 12:24:24 +0100

Think more slowly! Unless you want to average over countries, you need to use that too. 

You can define 5-year blocks whatever way you want, e.g. 

gen quinquennium = 5 * floor(year/5) 

and then use 

egen sd = sd(gdp), by(countryno quinquennium)

-- but -- and it's your problem not mine -- did you think about using rolling SDs rather than block-based SDs? Blocks are more arbitrary (why start a block in 2000 rather than 1999 or 2001, for example?). Check out -rolling-. 


lreine ycenna

I should've mentioned that I need 5-year standard deviations of the growth rate.
So I think I need to keep year instead of countryno. The average out
the SD for each 5 years.

On 20 May 2011 12:07, Oliver Jones <> wrote:

> Am 20.05.2011 13:01, schrieb Oliver Jones:
>> Leave out the variable year in the by() option and that should do what
>> you want.
> Or leave out the variable countryno.
> It depends on your aim:
> - sd over time for each country , or
> - sd over countries for each year

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index