[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: calculating moving standard deviation
In Stata 9,
. help rolling
In Stata 8,
. ssc desc mvsumm
Having said that, if you're happy with an sd based on
3 data points, especially when it will serve as a
denominator, you are much braver than I am!
> For a panel dataset, I am trying to create a standardized score
> variable, by country by year but am calculating it on a moving
> average basis. I have 50 countries for the 1960-2000 period. For
> example, a standardized score of period t, (ZXt) is calculated
> Xt minus mean (Xt, Xt-1 Xt-2 ), all divided by the standard deviation
> of (Xt, Xt-1 Xt-2 )
> Thus the ZXt+1= Xt+1 minus mean (Xt+1 Xt Xt-1 ), all divided by the
> standard deviation of (Xt+1, Xt Xt-1)
> I am calculating the mean by creating new variables of the
> lagged values
> of X and then averaging them.
> Any ideas on how I can get the standard deviation of just the 3 moving
> years, ( NOT my full sample period 1960-2000) by country.
> Any feedback would be much appreciated.
* For searches and help try: