[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: calculating moving standard deviation
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: