Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Slow -rolling- regressions on panel data
From
Partho Sarkar <[email protected]>
To
[email protected]
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 <[email protected]>
To [email protected]
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/