Rolling window GARCH volatility forecasting

3 visualizzazioni (ultimi 30 giorni)
Connor Mason
Connor Mason il 16 Mag 2019
Commentato: Mads il 11 Mar 2021
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

Risposte (0)

Categorie

Scopri di più su Conditional Variance Models in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by