Record the results from a series of rolling regression

Questions and discussions on Time Series Analysis
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

Record the results from a series of rolling regression

Unread post by ivory4 »

Hi, I implemented a series of rolling regression, as follows:

compute start=1979:3, end=1996:4
do i = 0, 48
linreg(noprint) y start+i end+i
# constant x1 x2
display i %beta $
%stderrs
end do i

How could I record the coefficients and std from each regression in a vector and write them in an excel?
It will be convenient for me to Graph and Record.

Thanks for kind reply and suggestions.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Record the results from a series of rolling regression

Unread post by TomDoan »

ivory4 wrote:Hi, I implemented a series of rolling regression, as follows:

Code: Select all

compute start=1979:3, end=1996:4
do i = 0, 48
   linreg(noprint) y start+i end+i
   # constant x1 x2
   display i %beta $
   %stderrs
   end do i
How could I record the coefficients and std from each regression in a vector and write them in an excel?
It will be convenient for me to Graph and Record.

Thanks for kind reply and suggestions.
The simplest thing to do there is to just write them all to a text file and import that into Excel.

Outside the loop:

open copy rolling.txt

Inside:

display(unit=copy) i %beta %stderrs
ivory4
Posts: 144
Joined: Mon Aug 24, 2009 12:16 pm

Re: Record the results from a series of rolling regression

Unread post by ivory4 »

This is really a good way of recording the results.
I am a little bit uncomfortable with the matrix representation in RATS, it is not as straight forward as in gauss.
But this small trick helps a lot.

Thanks.

ps: late reply because I use this many times after I read your post.
Post Reply