ROLLREG—rolling (linear) regressions

Use this forum to post complete RATS "procedures". Please be sure to include instructions on using the procedure and detailed references where applicable.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

ROLLREG—rolling (linear) regressions

Unread post by TomDoan »

@ROLLREG is a modernization of the Bank of Canada's ROLLREG procedure, which was written originally for version 4. This does three types of "rolling" linear regressions; the most important of which is done with the MOVE option; that does a moving window of a fixed width. (The ADD option can be done more efficiently and with more options using the RLS instruction).

Detailed description
Last edited by TomDoan on Mon Apr 23, 2018 3:44 pm, edited 4 times in total.
Reason: Switch to description from HTML help
challenges
Posts: 11
Joined: Thu Apr 14, 2011 12:29 pm

Re: ROLLREG - rolling (linear) regressions

Unread post by challenges »

Dear all,

I have to implement in the rollreg.src a normality test of Jarque-Bera on the residuals of my regression at each iteration inside my loop. I do not need to save my residuals, but I need to print the statistics of my test as well as the p-values associated to the test. Could you please help me? I have tried to do it myself but I got errors in my program.
Thank you in advance.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ROLLREG - rolling (linear) regressions

Unread post by TomDoan »

challenges wrote:Dear all,

I have to implement in the rollreg.src a normality test of Jarque-Bera on the residuals of my regression at each iteration inside my loop. I do not need to save my residuals, but I need to print the statistics of my test as well as the p-values associated to the test. Could you please help me? I have tried to do it myself but I got errors in my program.
Thank you in advance.
If you do a STATISTICS instruction on the residuals, it will produce %JBSTAT and %JBSIGNIF as the J-B statistic and p-value. You would just need to save those into a series the way the F-statistics are saved in the revised procedure that I posted.
basher
Posts: 14
Joined: Tue Mar 08, 2011 6:11 am

Re: ROLLREG - rolling (linear) regressions

Unread post by basher »

Hi Tom,

I am using your revised rollreg procedure for a regression of "y" on "x". As I also want to perform a hypothesis test on the slope of "x" (i.e. b=1), I replaced

if %defined(fhistory) ; compute fhistory(cut)=%fstat

with

test(noprint)
# 2
# 1
if %defined(fhistory) ; compute fhistory(cut)=%fstat

every place the first line occurs in the revised ROLLREG. However, when I write "print FHISTORY", I get error message. Also, how can I obtain the associated standard errors for the slope coefficients (along with the f-stat)? Thank you.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ROLLREG - rolling (linear) regressions

Unread post by TomDoan »

basher wrote:Also, how can I obtain the associated standard errors for the slope coefficients (along with the f-stat)? Thank you.
Instead of trying to adapt the ROLLREG procedure to do so many other things, you're probably better off just doing the rolling regression as described in the User's Guide and doing whatever additional calculations you want after each regression.
basher
Posts: 14
Joined: Tue Mar 08, 2011 6:11 am

Re: ROLLREG - rolling (linear) regressions

Unread post by basher »

Hi, I am still unable to obtain FHISTORY using "print / fhistory". I guess I need to know how to print the output options (e.g. COHISTORY, SEHISTORY, FIHISTORY) associated with this specific routine. Thank you.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: ROLLREG - rolling (linear) regressions

Unread post by TomDoan »

With a PRINT instruction as was just explained:

Code: Select all

@rollreg(cohist=cohist,fhistory=fhist,sehist=sehist,move=32) y
# constant x2 x3
print / cohist sehist fhist
If that doesn't work, you must have broken something in trying to change the procedure. The loop for a moving window is four lines long. It will be much easier to start with that than to try to change a procedure.


Last bumped by TomDoan on Mon Apr 23, 2018 3:47 pm.
Post Reply