Regression with expanding window and break points

2 views (last 30 days)
Dear All
I would like to do an expanding window regression with breaks points. I am struggling to build the code for that. Here is the idea.
The regression is: Y= a + Beta *X + Error
(1) we start the regression with 1 year rolling window and we expand it with one quarter, two quarters and so on.
(2) we break the expansion of the window once the "new Beta" (i.e. the Beta coming from the regression with expanded window) is outside the confidence interval of the first beta that we retrieved from the first regression (i.e. regression with 1 year window- this is the regression we started with at (1)).
(3) at the break point, we come 1 year backwards, rerun a new 1 year window regression and obtain a new confidence interval. We expand the window with one quarter, two quarters and so on until we reach a new break point (i.e. a break point is reached when the Beta of the expanded window regression is outside the confidence interval of the "new" 1 year window regression).
%%% for j=1:length(X)-261
[b,bint,~,~,~] = regress( (Y(1:261+j,:)) ,X(1:261:j,:));
end %%% This small code partly handles point (1) but I am not managing to build on it to address point (2) and (3). Any help or guidance would be much appreciated. Thank you!
Best Regards
S

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!