Forecasting¶
Multiperiod forecasts can be easily produced for ARCHtype models using forward recursion, with some caveats. In particular, models that are nonlinear in the sense that they do not evolve using squares or residuals do not normally have analytically tractable multiperiod forecasts available.
All models support three methods of forecasting:
Analytical: analytical forecasts are always available for the 1step ahead forecast due to the structure of ARCHtype models. Multistep analytical forecasts are only available for model which are linear in the square of the residual, such as GARCH or HARCH.
Simulation: simulationbased forecasts are always available for any horizon, although they are only useful for horizons larger than 1 since the first outofsample forecast from an ARCHtype model is always fixed. Simulationbased forecasts make use of the structure of an ARCHtype model to forward simulate using the assumed distribution of residuals, e.g., a Normal or Student’s t.
Bootstrap: bootstrapbased forecasts are similar to simulation based forecasts except that they make use of the standardized residuals from the actual data used in the estimation rather than assuming a specific distribution. Like simulationbase forecasts, bootstrapbased forecasts are only useful for horizons larger than 1. Additionally, the bootstrap forecasting method requires a minimal amount of insample data to use prior to producing the forecasts.
This document will use a standard GARCH(1,1) with a constant mean to explain the choices available for forecasting. The model can be described as
In code this model can be constructed using data from the S&P 500 using
from arch import arch_model
import datetime as dt
import pandas_datareader.data as web
start = dt.datetime(2000,1,1)
end = dt.datetime(2014,1,1)
sp500 = web.get_data_yahoo('^GSPC', start=start, end=end)
returns = 100 * sp500['Adj Close'].pct_change().dropna()
am = arch_model(returns, vol='Garch', p=1, o=0, q=1, dist='Normal')
The model will be estimated using the first 10 years to estimate parameters and then forecasts will be produced for the final 5.
split_date = dt.datetime(2010,1,1)
res = am.fit(last_obs=split_date)
Analytical Forecasts¶
Analytical forecasts are available for most models that evolve in terms of the squares of the model residuals, e.g., GARCH, HARCH, etc. These forecasts exploit the relationship \(E_t[\epsilon_{t+1}^2] = \sigma_{t+1}^2\) to recursively compute forecasts.
Variance forecasts are constructed for the conditional variances as
forecasts = res.forecast(horizon=5, start=split_date)
forecasts.variance[split_date:].plot()
Simulation Forecasts¶
Simulationbased forecasts use the model random number generator to simulate draws of the standardized residuals, \(e_{t+h}\). These are used to generate a prespecified number of paths of the variances which are then averaged to produce the forecasts. In models like GARCH which evolve in the squares of the residuals, there are few advantages to simulationbased forecasting. These methods are more valuable when producing multistep forecasts from models that do not have closed form multistep forecasts such as EGARCH models.
Assume there are \(B\) simulated paths. A single simulated path is generated using
where the simulated shocks are \(e_{t+1, b}, e_{t+2, b},\ldots, e_{t+h, b}\) where \(b\) is included to indicate that the simulations are independent across paths. Note that the first residual, \(\epsilon_{t}\), is insample and so is not simulated.
The final variance forecasts are then computed using the \(B\) simulations
forecasts = res.forecast(horizon=5, start=split_date, method='simulation')
Bootstrap Forecasts¶
Bootstrapbased forecasts are virtually identical to simulationbased forecasts except that the standardized residuals are generated by the model. These standardized residuals are generated using the observed data and the estimated parameters as
The generation scheme is identical to the simulationbased method except that the simulated shocks are drawn (i.i.d., with replacement) from \(\hat{e}_{1}, \hat{e}_{2},\ldots, \hat{e}_{t}\). so that only data available at time \(t\) are used to simulate the paths.
Forecasting Options¶
The forecast()
method is attached to a model fit result.`
params
 The model parameters used to forecast the mean and variance. If not specified, the parameters estimated during the call tofit
the produced the result are used.horizon
 A positive integer value indicating the maximum horizon to produce forecasts.start
 A positive integer or, if the input to the mode is a DataFrame, a date (string, datetime, datetime64 or Timestamp). Forecasts are produced fromstart
until the end of the sample. If not provided,start
is set to the length of the input data minus 1 so that only 1 forecast is produced.align
 One of ‘origin’ (default) or ‘target’ that describes how the forecasts aligned in the output. Origin aligns forecasts to the last observation used in producing the forecast, while target aligns forecasts to the observation index that is being forecast.method
 One of ‘analytic’ (default), ‘simulation’ or ‘bootstrap’ that describes the method used to produce the forecasts. Not all methods are available for all horizons.simulations
 A nonnegative integer indicating the number of simulation to use whenmethod
is ‘simulation’ or ‘bootstrap’
Understanding Forecast Output¶
Any call to forecast()
returns a ARCHModelForecast
object with has 3 core attributes and 1 which may be useful when using simulation or bootstrapbased forecasts.
The three core attributes are
mean
 The forecast conditional mean.variance
 The forecast conditional variance.residual_variance
 The forecast conditional variance of residuals. This will differ fromvariance
whenever the model has dynamics (e.g. an AR model) for horizons larger than 1.
Each attribute contains a DataFrame
with a common structure.
print(forecasts.variance.tail())
which returns
h.1 h.2 h.3 h.4 h.5
Date
20131224 0.489534 0.495875 0.501122 0.509194 0.518614
20131226 0.474691 0.480416 0.483664 0.491932 0.502419
20131227 0.447054 0.454875 0.462167 0.467515 0.475632
20131230 0.421528 0.430024 0.439856 0.448282 0.457368
20131231 0.407544 0.415616 0.422848 0.430246 0.439451
The values in the columns h.1
are onestep ahead forecast, while values in h.2
, …, h.5
are 2, …, 5observation ahead forecasts. The output is aligned so that the Date column is the final data used to generate the forecast, so that h.1
in row 20131231
is the onestep ahead forecast made using data up to and including December 31, 2013.
By default forecasts are only produced for observations after the final observation used to estimate the model.
day = dt.timedelta(1)
print(forecasts.variance[split_date  5 * day:split_date + 5 * day])
which produces
h.1 h.2 h.3 h.4 h.5
Date
20091228 NaN NaN NaN NaN NaN
20091229 NaN NaN NaN NaN NaN
20091230 NaN NaN NaN NaN NaN
20091231 NaN NaN NaN NaN NaN
20100104 0.739303 0.741100 0.744529 0.746940 0.752688
20100105 0.695349 0.702488 0.706812 0.713342 0.721629
20100106 0.649343 0.654048 0.664055 0.672742 0.681263
The output will always have as many rows as the data input. Values that are not forecast are nan
filled.
Output Classes¶
 class
arch.univariate.base.
ARCHModelForecast
(index, mean, variance, residual_variance, simulated_paths=None, simulated_variances=None, simulated_residual_variances=None, simulated_residuals=None, align='origin')[source]¶ Container for forecasts from an ARCH Model
 Parameters
index ({list, ndarray}) –
mean (ndarray) –
variance (ndarray) –
residual_variance (ndarray) –
simulated_paths (ndarray, optional) –
simulated_variances (ndarray, optional) –
simulated_residual_variances (ndarray, optional) –
simulated_residuals (ndarray, optional) –
align ({'origin', 'target'}) –

mean
¶ Forecast values for the conditional mean of the process
 Type
DataFrame

variance
¶ Forecast values for the conditional variance of the process
 Type
DataFrame

residual_variance
¶ Forecast values for the conditional variance of the residuals
 Type
DataFrame
 class
arch.univariate.base.
ARCHModelForecastSimulation
(values, residuals, variances, residual_variances)[source]¶ Container for a simulation or bootstrapbased forecasts from an ARCH Model
 Parameters

values
¶ Simulated values of the process
 Type
DataFrame

residuals
¶ Simulated residuals used to produce the values
 Type
DataFrame

variances
¶ Simulated variances of the values
 Type
DataFrame

residual_variances
¶ Simulated variance of the residuals
 Type
DataFrame