Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Slow -rolling- regressions on panel data |
Date | Tue, 27 Sep 2011 08:59:21 +0100 |
Actually, I would guess that Austin's suggestion will run faster than this, but we're just trading speculation. Nick On Tue, Sep 27, 2011 at 7:32 AM, Partho Sarkar <partho.ss+lists@gmail.com> wrote: > 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? > * * 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/