Page 1 of 1

Record the results from a series of rolling regression

Posted: Mon Aug 24, 2009 2:04 pm
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.

Re: Record the results from a series of rolling regression

Posted: Mon Aug 24, 2009 5:37 pm
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

Re: Record the results from a series of rolling regression

Posted: Thu Oct 01, 2009 10:22 pm
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.