Rolling regressions with conditions

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

SARIKA RAKHYANI
Posts: 3
Joined: Fri Jun 19, 2020 4:12 am

Rolling regressions with conditions

Postby SARIKA RAKHYANI » Fri Jun 19, 2020 10:33 am

I want to write a program in e-views that can let me run - 36 Months window rolling regressions on my monthly data, with at least 24 observations. This has to be done for 2000 stocks. How can I do it at a go? The equation has 2 independent variables, hence want to store 2 betas, their standard errors, intercept and standard error of regression as well.

For instance, say data starts from January 1999, then running the first regression on 36 months window from January 1999 to December 2001, requires that the output should come only if minimum 24 months data is available; otherwise that stock should be skipped for that particular regression. Next rolling regression will start from February 1999 and end at January 2002 (taking care of the minimum number of observations) and so on till March 2020. Since, it’s a monthly rolling regression, the regression output (intercept, 2 betas, their standard errors, standard error of regression) would be reported on monthly basis starting from December 2001 to March 2020.

Some genius please reply-
Even if you know a bit only like just the first part how do we take care of the minimum 24 observation condition, would be good enough to begin with.
If you believe that such a code is not possible to be written in e-views, then also please reply.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13318
Joined: Tue Sep 16, 2008 5:38 pm

Re: Rolling regressions with conditions

Postby EViews Gareth » Fri Jun 19, 2020 11:07 am

There are lots of examples of writing rolling regressions here on the forum.
Follow us on Twitter @IHSEViews

SARIKA RAKHYANI
Posts: 3
Joined: Fri Jun 19, 2020 4:12 am

Re: Rolling regressions with conditions

Postby SARIKA RAKHYANI » Mon Jun 22, 2020 12:04 am

But no code mentions how to run it with some conditions like - with at least 24 observations as I mentioned above. Also no code is there which could tell me ho can I do it for 100 stocks at a go. If you think there are such posts solving these as well, please direct me to such posts. Thanks.

EViews Matt
EViews Developer
Posts: 563
Joined: Thu Apr 25, 2013 7:48 pm

Re: Rolling regressions with conditions

Postby EViews Matt » Mon Jun 22, 2020 1:59 pm

Hello,

Your extra requirements would be relatively minor changes to a rolling regression program, (1) a new outer loop to go through each of your 100 stocks, and (2) an if statement to check whether you should skip the current regression if there are fewer than 24 non-NA observations available.

SARIKA RAKHYANI
Posts: 3
Joined: Fri Jun 19, 2020 4:12 am

Re: Rolling regressions with conditions

Postby SARIKA RAKHYANI » Tue Jun 23, 2020 9:03 pm

Thanks so much. I have explored a lot on forum, but still couldn't write a code myself. Different codes on forums for the same thing confuse me. I am not getting how to start it.
I do not know how to build an outer loop or write an if statement in the program in e-views, so will try to learn and build a code and then post it here. It would be great if you could direct me to some really easy content- readings or videos that can help me build a code myself.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13318
Joined: Tue Sep 16, 2008 5:38 pm

Re: Rolling regressions with conditions

Postby EViews Gareth » Tue Jun 23, 2020 10:03 pm

Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 90 guests