Forecast and estimate in rolling window
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to estimate the parameters in rolling window regression and then conduct a out-of sample fit forecast with realized values of predictor. I have the following data:
- The data set of the dependent variable is a vector of length T=521
- The data set predictor is a vector of length T=521
- In sample window size is denoted as r, r=400
- Forecast horizon is denoted as h, h=2
I have estimated my parameters using the following MATLAB code
for i=r:T
lm=fitlm(X(i-r+h+1:i),y_diff(i-r+h+1:i));
alpha(i,1)=lm.Coefficients.Estimate(1,:);
beta(i,1)=lm.Coefficients.Estimate(2,:);
end
1. Is this the correct way to implement a rolling window regression in MATLAB? It means my window rolls from 400(r) to 521(T) at interval of 1.
2. In order to analyze the stability of beta estimate should I plot these results? Or I should make the interval bigger such as r:10:T and than estimate the parameters?
3. I need to understand what exactly should I roll in order to perfom the regression? In sample size r already rolls from 400 to 521 so is that enough?
6 Kommentare
Brendan Hamm
am 30 Nov. 2016
I'm not sure how you are using h in this model as you do no forecasting. If you set this value to zero then all of the answers I give below hold. However with this set to 2 you are again shifting your frame of reference (see 3. below).
- Yes. This his how you would perform a rolling window regression.
- Plotting would be a good way to visually check the stability of the assets beta. I would not generally expect stability to hold in most cases as time-invariance is not typical, despite the assumptions of many models such as CAPM.
- Not sure what you mean here. r is not changing in this model; i is. You have the same sample size on every single regression (400), the difference is in the indices of the regressor and response variables. So in other words what is rolling is your frame in time:
Beta Estimate 1: t=1 to T=400
Beta Estimate 2: t=2 to T=401
Beta Estimate 3: t=3 to T=402 ...
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!