Rolling window GARCH volatility forecasting

조회 수: 3 (최근 30일)
Connor Mason
Connor Mason 2019년 5월 16일
댓글: Mads 2021년 3월 11일
After finding some success (or at least appears success) with estimating a one day GARCH rolling window volatility forecast, I have been unable to replicate the same results over longer forecast horizons. I think the problem is due to the 10 and 60 day forecasts generating forecasts up to and including the 10 and 60 day, and so MATLAB, or at least I, cannot obtain rolling forecasts in the same way I can with the one day forecasts.
The issue arises at line 25 where I receive the error message "Unable to perform assignment because the left and right sides have a different number of elements."
Does anyone know how I can fix this to obtain continous 10 and 60 day forecasts throughout?
% Import Returns data
Returns = CurrencyDataV2.Returns(1:2579);
% GARCH(1,1) Two year estimation window (504)
Model = garch(1,1);
for k=1:3
j=504;
T= length(Returns);
%rolling window moves along one each time
for tt=j+1:T
% Estimate GARCH models with a 504 observation window in a loop
EstModel = estimate(Model, Returns(tt-504:tt-1));
% Simulate 10000 paths to get the innovations
rng default;
[v,y]=simulate(EstModel,10000);
% Forecast the variance for each horizon
if k ==1
Volaoneday(tt-504:tt-1)=forecast(EstModel,1, y);
elseif k==2
Volatenday(tt-504:tt-1)=forecast(EstModel,10, y);
else
Volasixtyday(tt-504:tt-1)=forecast(EstModel,60, y);
end
j = j+1;
end
end
  댓글 수: 1
Mads
Mads 2021년 3월 11일
did you solve the problem back then? :)

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Conditional Variance Models에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by