Statalist The Stata Listserver


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

st: RE: computing growth rates by country


From   "Alex Ogan" <[email protected]>
To   <[email protected]>
Subject   st: RE: computing growth rates by country
Date   Tue, 16 May 2006 13:40:39 -0400

. clear

. input str10 Country         Year    GDP 

        Country       Year        GDP
  1. 
. Angola          1990    100 
  2. 
. Angola          1991    111 
  3. 
. Angola          1992    120 
  4. 
. Bangladesh      1990    240 
  5. 
. Bangladesh      1991    260 
  6. 
. Bangladesh      1992    275 
  7. end

. gen loggdp = log(GDP)

. egen minyearbycountry = min(Year), by(Country)

. gen yearcounter = Year-minyearbycountry 

. gen growthrate = .
(6 missing values generated)

. levelsof Country 
`"Angola"' `"Bangladesh"'

. foreach var in `r(levels)' {
  2. reg loggdp yearcounter if Country =="`var'"
  3. replace growthrate = _b[yearcounter] if Country =="`var'"
  4. }

      Source |       SS       df       MS              Number of obs =       3
-------------+------------------------------           F(  1,     1) =  143.10
       Model |  .016620574     1  .016620574           Prob > F      =  0.0531
    Residual |  .000116148     1  .000116148           R-squared     =  0.9931
-------------+------------------------------           Adj R-squared =  0.9861
       Total |  .016736722     2  .008368361           Root MSE      =  .01078

------------------------------------------------------------------------------
      loggdp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
 yearcounter |   .0911608   .0076206    11.96   0.053    -.0056686    .1879901
       _cons |    4.60957   .0098382   468.54   0.001     4.484564    4.734576
------------------------------------------------------------------------------
(3 real changes made)

      Source |       SS       df       MS              Number of obs =       3
-------------+------------------------------           F(  1,     1) =   96.90
       Model |  .009265993     1  .009265993           Prob > F      =  0.0645
    Residual |  .000095628     1  .000095628           R-squared     =  0.9898
-------------+------------------------------           Adj R-squared =  0.9796
       Total |  .009361621     2  .004680811           Root MSE      =  .00978

------------------------------------------------------------------------------
      loggdp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
 yearcounter |   .0680661   .0069148     9.84   0.064    -.0197943    .1559265
       _cons |   5.484631   .0089269   614.39   0.001     5.371204    5.598058
------------------------------------------------------------------------------
(3 real changes made)

. list Country Year GDP growthrate

     +------------------------------------+
     |    Country   Year   GDP   growth~e |
     |------------------------------------|
  1. |     Angola   1990   100   .0911608 |
  2. |     Angola   1991   111   .0911608 |
  3. |     Angola   1992   120   .0911608 |
  4. | Bangladesh   1990   240   .0680661 |
  5. | Bangladesh   1991   260   .0680661 |
     |------------------------------------|
  6. | Bangladesh   1992   275   .0680661 |
     +------------------------------------+

________________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of Broca, Sumiter (ESDG)
Sent: Tuesday, May 16, 2006 1:22 PM
To: [email protected]
Subject: st: computing growth rates by country

I would appreciate some help on the following problem. 
I have time-series data arranged like this, sorted by country year (hypothetical data): 
Country         Year    GDP 
Angola          1990    100 
Angola          1991    111 
Angola          1992    120 
Bangladesh      1990    240 
Bangladesh      1991    260 
Bangladesh      1992    275 
. 
. 
. 
(57 countries)    
I would like to compute the long run GDP growth rate between 1990 and 1992 for each country by regressing log(GDP(t)) on time (from 1990-92) for that country. The growth rate is given by the coefficient estimate (multiplied by 100 if you want it in percentages). I would like to append this growth rate to the above data set.  For this example, I would like the new data set to look like this. 

Country         Year    GDP  GDP growth rate, 1990-92 (% p.a.) 
Angola          1990    100    9.1 
Angola          1991    111    9.1 
Angola          1992    120    9.1 
Bangladesh      1990    240    6.8 
Bangladesh      1991    260    6.8 
Bangladesh      1992    275    6.8 
. 
. 
. 
In other words, I am looking for an egen type command that calculates a semi-log growth rate for each country and then appends it to the data set for that country.  Can someone point me to one? 
Thanks in advance. 
Sumiter. 
Sumiter S. Broca

Economist,
Global Perspectives Studies Unit,
Office of the Assistant Director-General,
Economic and Social Department
Food and Agriculture Organization of the United Nations
Viale delle Terme di Caracalla - 00100 Rome
ITALY 
Tel: +39 06 5705 3896
Cell: +39 349 2375 960
Fax: +39 06 5705 6172
 email: [email protected] 


This message is intended solely for the designated recipient(s). It may contain confidential or proprietary information and may be subject to confidentiality protections. If you are not a designated recipient, you may not review, copy, or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message. 

Arrowstreet Capital, L.P. is an Equal Opportunity Employer. 



*
*   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