Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Time series with moving average growth rate


From   Robert A Yaffee <bob.yaffee@nyu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Time series with moving average growth rate
Date   Tue, 03 Jun 2008 13:18:02 -0400

Dear Marcello and Humnath,

You have to be clear about whether your terminology is conventional or not.
For the conventional meaning of a moving average, the answer to your
question would be as follows:

You can easily generate a 3 month moving average after tssetting your
data, with the command
 
tssmooth ma newvarname=country1, window(3,1,0)

or

tssmooth ma newvarname=country1, window(3,0,0)


depending on whether you wish the current observation included in the moving average.

for each country separately, though I have done it only for country1 here..




If you mean that you wish to average the three country scores, and then compute a regression on time
then the answer would be quite different.   In that case the answer would be quite different.
You might wish to use a prais regression on time.

Regards,
     Bob Yaffee





Robert A. Yaffee, Ph.D.
Research Professor
Silver School of Social Work
New York University


----- Original Message -----
From: Marcello Pagano <pagano@hsph.harvard.edu>
Date: Tuesday, June 3, 2008 10:37 am
Subject: st: Time series with moving average growth rate
To: statalist@hsphsun2.harvard.edu


> *************************
> 
> Dear list members,
>  
> I have time series data (2000-2007) on crop yield for three countries. 
> I 
> would like to calculate 3-year moving average   growth rate for each 
> country, i.e. one year increase in every subsequent period (e.g. 
> 2000-02, 2001-03,.....2005-07). My equation is log(yield) = a + 
> b(time). 
> The growth rate is (b*100). I would like to write a loop command or 
> any 
> other procedure which produce 3-year moving average growth rate for 
> entire period ( six values in this case) for each country. I would be 
> 
> grateful if anyone from this list can help me in this regard. The 
> hypothetical data is given below.
>  
> 
> Year   country1   country2   country3
> 
> 2000   1.6    1.1    1.8
> 
> 2001   1.7    1.2    1.9
> 
> 2002   1.9    1.1    2.0
> 
> 2003   2.1    1.3    2.1
> 
> 2004   2.4    1.5    2.6
> 
> 2005   2.7    1.8    2.5
> 
> 2006   3.1    2.1    2.9
> 
> 2007   3.5    2.3    3.2
> 
>  
> 
> Sincerely,
> 
> Humnath Bhandari,
> 
> IRRI, Philippines
> 
> *
> *   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/
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index