Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Slow -rolling- regressions on panel data


From   Partho Sarkar <partho.ss+lists@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Slow -rolling- regressions on panel data
Date   Tue, 27 Sep 2011 12:02:36 +0530

Richard

If all you really want is the autocorrelation coefficient, of course
you don't really need -regress-, which does much more than just
generate the regression coefficients.  As an alternative to Austin's
suggestion (and apriori I would expect this to be faster)
you could also get the AC's via matrix computations in Mata, successively
passing the  y-vector (and the lagged y-vector?) for each firm to Mata
within a loop, computing the sums, inner products etc., and passing
the result back to Stata.

Of course, Nick's point still holds: given your data size, this is
likely to be time-consuming in any case.

As a last thought, you are presumably interested in doing this for
some "real" data- I think you might have an ill-conditioned matrix
with your artificial example, which would partly account for the slow
regressions.

Hope this helps

Partho

___________________________
From  Richard Herron <richard.c.herron@gmail.com>
To  statalist@hsphsun2.harvard.edu
Subject  st: Slow -rolling- regressions on panel data
Date  Mon, 26 Sep 2011 10:37:35 -0400
________________________________

I am using -rolling- for rolling regressions on panel data, but it is
exceedingly slow. I found a Statalist thread
(http://www.stata.com/statalist/archive/2009-09/msg01239.html) with a
more manual solution, but it is equally slow (both are too slow to run
to completion in a reasonable amount of time).

Is -regress- the bottleneck? I only want the AR(1) coefficient; is
there a different approach I should take? Are rolling
regressions/calculations best done in different software?

Thanks!

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