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

From |
"Austin Nichols" <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Computing GDP growth using a log-linear regression |

Date |
Mon, 21 Jul 2008 11:18:17 -0400 |

D Harwood <bus4dpah@leeds.ac.uk>: First -tsset- the data, -sort- by code and year, and then compute the difference: by code: g growth=d.lnGDP which is roughly the percentage change in levels. Or in 2 lines: tsset code year bys code (year): g growth=d.lnGDP See also -help tsvarlist-. On Mon, Jul 21, 2008 at 11:05 AM, D Harwood <bus4dpah@leeds.ac.uk> wrote: > No you're right I want the annual growth rates not the trend. Have I been > going about this totally the wrong way? What would be the best way to > compute the annual growth rates? > > Thanks, > > Dave > > Quoting Austin Nichols <austinnichols@gmail.com>: > >> D Harwood <bus4dpah@leeds.ac.uk>: >> >> Take the double quotes off =="`var'" is the short answer--you can't >> compare a number to a quoted string. >> But are you sure you want the avg change computed over all years (i.e. >> the trend, not the annual GDP growth rates)? >> And there is no need to generate yearcounter that I can see... >> >> On Mon, Jul 21, 2008 at 10:41 AM, D Harwood <bus4dpah@leeds.ac.uk> wrote: >>> >>> Dear All, >>> >>> I was wondering if anyone knew how to compute GDP growth rates by >>> country. I >>> have panel data arranged as follows: >>> >>> Country Year GDP ($ 2000) >>> Benin 1997 1947193088 >>> Benin 1998 2035610240 >>> Benin 1999 2131227520 >>> Benin 2000 2254838784 >>> Benin 2001 2367580672 >>> Benin 2002 2474121728 >>> Benin 2003 2570612480 >>> Benin 2004 2650301440 >>> Benin 2005 2727160320 >>> . >>> . >>> . >>> >>> And so on for a number of countries. Arranged by country code and by >>> year. >>> >>> I found an example in the archives of how to calculate the growth rates >>> (http://www.stata.com/statalist/archive/2006-05/msg00529.html) and yet >>> when >>> I try to do the same I get an error message 'Type mismatch', no matter >>> which >>> variable type I enter. I typed the following into the command box and >>> came >>> out with the output shown. >>> >>> . egen minyearbycountry = min(year), by(code) >>> r; t=0.00 15:30:23 >>> >>> . gen yearcounter = year-minyearbycountry >>> r; t=0.01 15:30:31 >>> >>> . gen g = . >>> (288 missing values generated) >>> r; t=0.00 15:30:39 >>> >>> . levelsof code >>> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 >>> 28 >>> 29 30 31 32 >>> r; t=0.01 15:30:48 >>> >>> . foreach var in `r(levels)' { >>> 2. reg lnGDP yearcounter if code =="`var'" >>> 3. replace g = _b[yearcounter] if code =="`var'" >>> 4. } >>> type mismatch >>> r(109); t=26.93 15:31:23 >>> >>> I would be grateful if anyone could point out where I have gone wrong? >>> >>> Regards, >>> >>> Dave >> >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/statalist/faq >> * http://www.ats.ucla.edu/stat/stata/ >> > > > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Computing GDP growth using a log-linear regression***From:*D Harwood <bus4dpah@leeds.ac.uk>

**Re: st: Computing GDP growth using a log-linear regression***From:*"Austin Nichols" <austinnichols@gmail.com>

**Re: st: Computing GDP growth using a log-linear regression***From:*D Harwood <bus4dpah@leeds.ac.uk>

- Prev by Date:
**Re: st: Computing GDP growth using a log-linear regression** - Next by Date:
**st: poverty/inequality analysis** - Previous by thread:
**Re: st: Computing GDP growth using a log-linear regression** - Next by thread:
**st: automatically label interaction terms** - Index(es):

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