How forecast function works for ARIMA-GARCH models?
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
In Matlab documentation forecast have the following outputs and inputs:
% [Y,YMSE,V] = forecast(Mdl,numperiods,Y0,Name,Value)
I don't get:
- How output are calculated without presample data?
- What is the difference between YMSE and V?
Let's consider this example (NB I use Yahoo Finance and Quandl data downloader):
clear all
clc
% time period
date_start = datetime('31-Dec-2020');
date_end = datetime('today');
% download data
SP50 = table2timetable(getMarketDataViaYahoo('^GSPC',date_start,date_end,'1d'));
data = SP50.AdjClose;
DateReturns = SP50.Date(2:end);
series = 'SP50';
% calculate returns
Returns = price2ret(data);
SampleSize = size(Returns,1);
N = size(Returns,2);
% estimation window and test window
DateReturns = DateReturns(2:end);
EstimationWindoWStart = find(year(DateReturns)==2021,1,'first');
TestWindowStart = find(year(DateReturns)==2022,1,'first');
EstimationWindowSize = 252;
TestWindow = TestWindowStart:SampleSize;
% estimation window
EstimationWindow = 253 - EstimationWindowSize:(253-1);
% AR(1) + GARCH(1,1)
MdlVar = garch(1,1);
MdlAvgVar = arima('ARLags',1,'Variance',MdlVar);
% model estimation
EstMdlVarAvg = estimate(MdlAvgVar,Returns(EstimationWindow));
% calculate conditional variances
[Residuals,ConditionalVariances] = infer(EstMdlVarAvg,Returns(EstimationWindow));
figure
plot(DateReturns(EstimationWindow),sqrt((Residuals).^2),'LineWidth',1)
hold on
plot(DateReturns(EstimationWindow),sqrt(ConditionalVariances),'LineWidth',1)
omega = EstMdlVarAvg.Variance.Constant;
alpha = cell2mat(EstMdlVarAvg.Variance.ARCH);
beta = cell2mat(EstMdlVarAvg.Variance.GARCH);
phi0 = EstMdlVarAvg.Constant;
phi1 = cell2mat(EstMdlVarAvg.AR);
% without presample data how are Y,YMSE and V calculated?
[Y,YMSE,V] = forecast(EstMdlVarAvg,1)
% with presample I get that in:
[Y,YMSE,V] = forecast(EstMdlVarAvg,1,'Y0',Returns(EstimationWindow),'V0',ConditionalVariances,'E0',Residuals)
% Y corresponds to:
Y = phi0 + phi1 * Returns(EstimationWindow(end));
% V corresponds to:
V = omega + alpha * (Residuals(end))^2 + beta * ConditionalVariances(end)
% what is YMSE?
0 comentarios
Respuestas (1)
Karanjot
el 21 de Sept. de 2023
Hi Barbab,
I understand that you want to know about the working of ‘forecast’ function for ARIMA-GARCH models.
The pre-sample data is specified in the ‘forecast’ function using the argument 'Y0'. ‘YMSE’ represents the forecast error variances of the predicted responses. It tells us how well the forecasted values match the actual values. For each time point in the forecast period, ‘YMSE’ provides the forecast error variances for all possible paths. It can be a column vector or a matrix, depending on the number of paths and the length of the forecast period.
On the other hand, ‘V’ provides information about the uncertainty or variability in the forecasted values. It represents the minimum mean squared error (MMSE) forecasts of the conditional variances of future model innovations. If the model has a conditional variance component, ‘V’ contains the conditional variance forecasts for each period. Otherwise, it is a matrix composed of the constant variance value specified in the model. Similar to ‘YMSE’, ‘V’ can be a column vector or a matrix, depending on the number of paths and the length of the forecast period.
[Y,YMSE] = forecast(Mdl,numPeriods,Y0,Name,Value)
In summary, the above function returns the numperiods-by-1 numeric vector of consecutive forecasted responses ‘Y’, a numperiods-by-1 numeric vector of conditional variances ‘V’ from a composite conditional mean and variance model and the corresponding numeric vector of forecast mean square errors (MSE) ‘YMSE’ of the fully specified, univariate ARIMA model Mdl. The presample response data in the numeric vector ‘Y0’ initializes the model to generate forecasts.
To learn more about this, please refer to the below example:
I hope this helps!
0 comentarios
Ver también
Categorías
Más información sobre Conditional Variance Models en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!