Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: calculating moving standard deviation


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: calculating moving standard deviation
Date   Tue, 14 Jun 2005 17:39:45 +0100

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! 

Nick 
[email protected] 

Yatawara, Ravi
 
> 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:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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