converting garchsim with simulate or filter

2 views (last 30 days)
Hello,
regarding the use of the garch functions with the 2016a version of Matlab, I would like to translate the garchsim function to the new one.
The code that I am trying to translate is the following:
bootstrappedResiduals = standardizedResiduals(unidrnd(T, horizon, nTrials));
preResidual = residuals(end); % Presample model residuals
preSigma = sigmas(end); % Presample volatilities
preReturn = returns(end); % Presample returns
[~, ~, portfolioReturns] = ...
garchsim(spec, horizon, nTrials, bootstrappedResiduals , preResidual, preSigma, preReturn);
I have used the following function to model a garch and get the residuals
Mdl = garch(1,1);
[EstMdl,EstParamCov] = estimate(Mdl,returns);
se = sqrt(diag(EstParamCov));
v = infer(EstMdl,returns);
sigmas = sqrt(v);
res = (returns-EstMdl.Offset)./sigmas ;
s = RandStream.getGlobalStream(); reset(s)
nTrials = 1000; % # of independent random trials
horizon = horizon;
bootstrappedResiduals = res(unidrnd(T, horizon, nTrials));
and the following code instead of "garchsim"
preResidual = res(end); % Presample model residuals
preSigma = sigmas(end); % Presample volatilities
preReturn = returns(end);
[~, portfolioReturns] = simulate (EstMdl ,60, 'NumPaths', nTrials, 'E0', preReturn, 'V0', preSigma) ;
or, instead of "simulate", the function "filter" with the following code
portfolioReturns = filter(EstMdl, bootstrappedResiduals, 'Y0', preReturn, );
The code works till the end but I get poor results ( long story short : the output portfolioReturns is used to forecast the expected Returns of a list of Assets and these expected Returns are not reasonable given the historic returns of the same assets).
I don't understand why the "garchsim" function could take the three inputs 'Y0', 'Z0', 'V0', and now both simulate and filter don't allow me to use those inputs.
What would be the best way to replace garchsim but in a way that allows me to use the three inputs "preReturns", "preSigma" and "preResiduals".
Thanks in advance for you help.

Answers (1)

Hang Qian
Hang Qian on 19 Aug 2016
Hello Sandro,
GARCHSIM has been retired and is no longer available in the Econometrics Toolbox.
One way to recover "preReturns", "preSigma" and "preResiduals" is to construct a ARIMA model with GARCH errors. In the ARIMA constructor, there is a name-value pair ‘variance’, in which a GARCH model can be inserted. The SIMULATE method of ARIMA has Y0, V0 and E0 name-value pairs, and I assume that appropriate values can be put in those name-value pairs to make them "preReturns", "preSigma" and "preResiduals".
Regards,
Hang Qian

Categories

Find more on Conditional Variance Models 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!