GARCH_toolbox_ARMA_quick_guide

A quick guide to MATLAB GARCH Toolbox
for ARMA modelling
Download the econ.zip package and unzip it anywhere on your PC. Run Matlab. From menu
File → Set path, choose Add with Subfolders and find the unzipped econ folder. Clock Save
and close. Now, wherever you save a working Matlab script for data analysis, you can call any
of the functions included in econ directly.
1. Autocorrelation (ACF)
Use function autocorr(X,nlags). The function calculates and plots the autocorrelation
coefficients. The inputs are:
• X – time series
• nlags – the number of lags for which the ACF coefficients are to be calculated.
2. Partial autocorrelation (PACF)
Use function parcorr(X,nlags). The function calculates and plots the partial autocorrelation coefficients. The inputs are:
• X – time series
• nlags – the number of lags for which the PACF coefficients are to be calculated.
3. Stationarity test
(a) KPSS test
h = kpsstest(y) assesses the null hypothesis that a univariate time series y is
trend stationary against the alternative that it is a nonstationary unit-root process.
Values of h equal to 1 indicate rejection of the trend-stationary null in favor of the
unit-root alternative. Values of h equal to 0 indicate a failure to reject the null.
(b) Augmented Dickey-Fuller test for unit root
h = adftest(y) assesses the null hypothesis of a unit root in a univariate time
series y.
(c) Phillips-Perron unit root test
h = pptest(y) assesses the null hypothesis of a unit root in a univariate time series
y.
4. Choice of model order
To set the model order (chosen based on the visual analysis of ACF and PACF), use
garchset.
Spec = garchset(param1,val1,param2,val2,...) creates an ARMA-GARCH model
specification structure Spec using the parameter-value pairs specified in the input argument list. The most important garchset parameters for ARMA fit are presented in the
table below.
1
Parameter
R
M
C
Value
Nonnegative
integer
scalar. Default is 0.
Nonnegative
integer
scalar. Default is 0.
Scalar coefficient. Default is [].
Description
Autoregressive model order of an
ARMA(R,M) model.
Moving-average model order of an
ARMA(R,M) model.
Conditional mean constant. If C = NaN,
garchfit ignores C, effectively fixing C =
0, without requiring initial estimates for
the remaining parameters.
For instance, to prepare for fitting and ARMA(3,1) model we would set
Spec = garchset(’R’,3,’M’,1).
5. ARMA model estimation
After having chosen and set the model order, run model estimation and fitting using
garchfit.
[Coeff,Errors,LLF,Innovations,Sigmas,Summary] = garchfit(Spec,Series)
The function takes in the chosen model to be fitted in Spec, and the data Series. The
outputs are:
• Coeff – GARCH specification structure containing the estimated coefficients. Coeff
is of the same form as the Spec input structure.
• Errors – Structure containing the estimation errors (that is, the standard errors)
of the coefficients. Errors is of the same form as the Spec and Coeff structures.
If an error occurs in the calculation of the standard errors, garchfit sets all fields
associated with estimated coefficients to NaN.
• LLF – Optimized loglikelihood objective function value associated with the parameter estimates found in Coeff. garchfit performs the optimization using the
Optimization Toolbox fmincon function.
• Innovations – Innovations (that is, residuals) time series column vector inferred
from Series. The size of Innovations is the same as the size of Series. If an
error occurs, garchfit returns Innovations as a vector of NaNs.
• Sigmas – Conditional standard deviation vector corresponding to Innovations.
The size of Sigmas is the same as the size of Series. If an error occurs, garchfit
returns Sigmas as a vector of NaNs.
• Summary – Structure of summary information about the optimization process.
6. Goodness-of-fit – information criteria
For calculating Akaike and Bayesian information criteria use
[AIC,BIC] = aicbic(LLF,NumParams,NumObs) – computes both the Akaike (AIC) and
Bayesian (BIC) information criteria. Perform multiple computations by passing vector values for any input. Since information criteria penalize models with additional
parameters, parsimony is the basis of the AIC and BIC model order selection criteria.
2