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 Center および File ExchangeConditional Variance Models についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by