Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: speed of xtabond2


From   Kit Baum <[email protected]>
To   [email protected]
Subject   st: re: speed of xtabond2
Date   Fri, 10 Dec 2004 08:54:53 -0500

Cher said

"I asked a question previously regarding the speed of "xtabond2" command in
Stata (please see below), since it's unbearably slow to play with large
datasets. However, I got the reply from its author saying there's little to
be done about it given the way this programme was written. In particular,
"xtabond2" was not written in compiled C++ as opposed to "xtabond". I am no
good in programming and am wondering whether anybody has written his/her own
version in C++. Or could anyone kindly tell me whether there's any other way
to speed up the computation or to obtain system GMM estimators in Stata? "

The assertion (be it his or David Roodman's) that xtabond is written in C/C++ is incorrect:

. which xtabond
/Applications/Stata/ado/updates/x/xtabond.ado
*! version 3.5.9 20sep2004

It is an ado-file, like almost all of the 'xt' routines (and over 80% of the commands in Stata 8).

The major slowdown in xtabond2 is the "Windmeijer correction" that allows consistent standard errors to be computed for two-step estimates. If you don't need to compute them while analyzing a number of specifications, don't, and the routine will run much faster. The other thing that may be increasing runtime dramatically is letting the A-B estimator come up with hundreds of instruments (if T is nontrivial). You can avoid this (which does little good anyway from an econometric standpoint) by using the options that limit how far back the lagged instruments go.

It is possible that the routine could be coded more efficiently; it is a volunteer effort by a smart guy, but he (like me, or any member of the Stata user community) doesn't work at StataCorp LP and doesn't do this for a living. It stands to reason that those who do are more skilled at squeezing the inefficiencies out of code.

Personally, I have lobbied for a long time for StataCorp to take a hard look at xtabond2, which IMHO has a more flexible and usable syntax than official xtabond, and implements the system GMM estimator and the Windmeijer correction (for instance, Greene's econometrics text has an example of A-B which is impossible to estimate via xtabond, but can be done with xtabond2. Otherwise official Stata compares poorly with GAUSS, Ox, and other packages in which the full set of A-B tools are available.

Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html

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