Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: re: calculating growth rates in a panel dataset


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: re: calculating growth rates in a panel dataset
Date   Mon, 13 Oct 2008 15:03:37 +0200

See [U] 11.4.3 and [U] 13.8 for further information on this approach...


HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kit Baum
Sent: Monday, October 13, 2008 2:47 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: re: calculating growth rates in a panel dataset

< >
Martin suggested

- bys id: g salesgrowth=(sales[_n]-sales[_n-1])/sales[_n-1]-

This works, but I spend some time every year when I lecture about  
panel data explaining to students why it is a Very Bad Idea to do so.

bys id: g salesgrowth = D.sales/L.sales
or
bys id: g salesgrowth = log(D.sales)

is a much safer way to do this, as the time-series operators will  
catch any issues with the time index (what if period 4 was not  
recorded for a given firm?). It requires that the data be -xtset- or - 
tsset-, and doing so will also catch some miscoding if the time index.  
Best to have Stata look for such mistakes in the process of data  
transformation. Very misleading results can be produced if you use  
explicit subscripts and the observation is completely missing (not  
Stata missing, but not recorded at all).

Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html


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



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