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 on April 23, and its replacement, is already up and running.

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

Re: st: Slow -rolling- regressions on panel data

From   Richard Herron <>
Subject   Re: st: Slow -rolling- regressions on panel data
Date   Tue, 27 Sep 2011 06:59:37 -0400

Thanks, all, for the input!

I was able to get a serviceable solution using -correlate- to find beta.

The next think I need to learn in Stats is writing my own .ado files
and using Mata (when you loop over the existing functions, I think
there can be too much overhead).

On Tue, Sep 27, 2011 at 03:59, Nick Cox <> wrote:
> 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
> <> 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 <>
>> To
>> 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
>> ( 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:
> *
> *
> *

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index