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

From |
"Martin Weiss" <martin.weiss@uni-tuebingen.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Time series with moving average growth rate |

Date |
Tue, 3 Jun 2008 18:31:04 +0200 |

Check this for consistency with what you had in mind: ********** cap drop grrate* g grrate1= country1[_n]/country1[_n-1]-1 g grrate2= country2[_n]/country2[_n-1]-1 g grrate3= country3[_n]/country3[_n-1]-1 qui foreach level in 2000 2001 2002 2003 2004 2005{ su grrate1 if year<=`=`level'+2'&year>=`level', mean noi di in red "Avg. Growth rate in country 1 in period `level' to `=`level'+2': " r(mean) } qui foreach level in 2000 2001 2002 2003 2004 2005{ su grrate2 if year<=`=`level'+2'&year>=`level', mean noi di in red "Avg. Growth rate in country 2 in period `level' to `=`level'+2': " r(mean) } qui foreach level in 2000 2001 2002 2003 2004 2005{ su grrate3 if year<=`=`level'+2'&year>=`level', mean noi di in red "Avg. Growth rate in country 3 in period `level' to `=`level'+2': " r(mean) } drop grrate* ********** Martin Weiss _________________________________________________________________ Diplom-Kaufmann Martin Weiss Mohlstrasse 36 Room 415 72074 Tuebingen Germany Fon: 0049-7071-2978184 Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130 Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131 SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945 -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Marcello Pagano Sent: Tuesday, June 03, 2008 4:36 PM To: statalist@hsphsun2.harvard.edu Subject: st: Time series with moving average growth rate ************************* 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/

**References**:**st: Time series with moving average growth rate***From:*Marcello Pagano <pagano@hsph.harvard.edu>

- Prev by Date:
**st: recommendation for learning to write Stata ado-files** - Next by Date:
**st: RE: recommendation for learning to write Stata ado-files** - Previous by thread:
**st: Time series with moving average growth rate** - Next by thread:
**Re: st: Time series with moving average growth rate** - Index(es):

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