Estimate ARMAX/GARCH model parameters
[...] = garchfit(Spec,Series)
[...] = garchfit(Spec,Series,X)
[...] = garchfit(Spec,Series,X,...PreInnovations,PreSigmas,PreSeries)
Given an observed univariate return series, garchfit estimates the parameters of a conditional mean specification of ARMAX form, and conditional variance specification of GARCH, EGARCH, or GJR form. The estimation process infers the innovations (that is, residuals) from the return series. It then fits the model specification to the return series by maximum likelihood.
[Coeff,Errors,LLF,Innovations,Sigmas,Summary] = garchfit(Series) models an observed univariate return series as a constant, C, plus GARCH(1,1) conditionally Gaussian innovations. For models more complicated than this one, you must provide model parameters in the GARCH specification structure Spec.
[...] = garchfit(Spec,Series,X,...
PreInnovations,PreSigmas,PreSeries) uses presample observations, contained in the time series vectors PreInnovations, PreSigmas, and PreSeries, to infer the outputs Innovations and Sigmas. These vectors form the conditioning set used to initiate the inverse filtering, or inference, process. If you provide no explicit presample data, the necessary presample observations derive from conventional time series techniques.
garchfit(...) with input arguments as shown but with no output arguments, displays the final parameter estimates and standard errors. It also produces a tiered plot of the original return series, the inferred innovations, and the corresponding conditional standard deviations.
GARCH specification structure containing the conditional mean and variance specifications. It also contains the optimization parameters needed for the estimation. Create this structure by calling garchset, or use the Coeff output structure returned by garchfit.
Time series column vector of observations of the underlying univariate return series of interest. Series is the response variable representing the time series to be fitted to conditional mean and variance specifications. The last element of Series holds the most recent observation.
Time series regression matrix of observed explanatory data. Typically, X is a matrix of asset returns (for example, the return series of an equity index), and represents the past history of the explanatory data. Each column of X is an individual time series used as an explanatory variable in the regression component of the conditional mean. In each column, the first row contains the oldest observation and the last row the most recent.
The number of valid (non-NaN) most recent observations in each column of X must equal or exceed the number of valid most recent observations in Series. If the number of valid observations in a column of X exceeds that of Series, garchfit uses only the most recent observations of X. If X =  or is unspecified, the conditional mean has no regression component.
Time series vector of presample innovations that garchfit uses to condition the recursive mean and variance models. This vector can have any number of elements, provided it contains sufficient observations to initialize the mean and variance equations. That is, if M and Q are the number of lagged innovations required by the conditional mean and variance equations, respectively, then PreInnovations must have at least max(M,Q) elements. If the number of elements exceeds max(M,Q), then garchfit uses only the last (that is, most recent) max(M,Q) observations.
Time series vector of positive presample conditional standard deviations that garchfit uses to condition the recursive variance model. This vector can have any number of elements, as long as it contains sufficient observations to initialize the conditional variance equation. That is, if P and Q are the number of lagged conditional standard deviations and lagged innovations required by the conditional variance equation, respectively, then PreSigmas must have at least P elements for GARCH and GJR models, and at least max(P,Q) elements for EGARCH models. If the number of elements exceeds the requirement, then garchfit uses only the last (that is, most recent) observations.
Time series vector of presample observations of the return series of interest that garchfit uses to condition the recursive mean model. This vector can have any number of elements, provided it contains sufficient observations to initialize the conditional mean equation. Thus, if R is the number of lagged observations of the return series required by the conditional mean equation, then PreSeries must have at least R elements. If the number of elements exceeds R, then garchfit uses only the last (that is, most recent) R observations.
GARCH specification structure containing the estimated coefficients. Coeff is of the same form as the Spec input structure. Toolbox functions such as garchset, garchget, garchsim, garchinfer, and garchpred can accept either Spec or Coeff as input arguments.
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.
Optimized loglikelihood objective function value associated with the parameter estimates found in Coeff. garchfit performs the optimization using the Optimization Toolbox™ fmincon function.
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.
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.
Structure of summary information about the optimization process. The fields and their possible values are as follows:
Describes the exit condition:
One of the following strings:
One of the following strings:
One of the following strings:
Covariance matrix of the parameter estimates
Number of iterations
Number of function evaluations
Structure, output by fmincon, containing the Lagrange multipliers at the solution x
Note garchfit calculates the error covariance matrix of the parameter estimates Summary.covMatrix, and the corresponding standard errors found in the Errors output structure using finite difference approximation. In particular, it calculates the standard errors using the outer-product method. For more information, see Section 5.8 in Hamilton (References follow).
The following example uses garchfit to estimate the parameters for a return series of 1000 simulated observations based on a GARCH(1,1) model. Because the 'Display' parameter defaults to 'on', garchfit displays diagnostic and iterative information:
spec = garchset('C',0,'K',0.0001,'GARCH',0.9,'ARCH',0.05); rng('default') % make output reproducible [e,s,y] = garchsim(spec,1000); [Coeff,Errors] = garchfit(spec,y);
Warning: Warning: GARCHSET will be removed in a future release. Use ARIMA, GARCH, EGARCH, and GJR models instead. Warning: Warning: GARCHSIM will be removed in a future release. Use SIMULATE of ARIMA, GARCH, EGARCH, and GJR models instead. Warning: GARCHFIT will be removed in a future release. Use ESTIMATE of ARIMA, GARCH, EGARCH, and GJR models instead. ____________________________________________________________ Diagnostic Information Number of variables: 4 Functions Objective: internal.econ.garchllfn Gradient: finite-differencing Hessian: finite-differencing (or Quasi-Newton) Nonlinear constraints: armanlc Nonlinear constraints gradient: finite-differencing Constraints Number of nonlinear inequality constraints: 0 Number of nonlinear equality constraints: 0 Number of linear inequality constraints: 1 Number of linear equality constraints: 0 Number of lower bound constraints: 4 Number of upper bound constraints: 4 Algorithm selected medium-scale: SQP, Quasi-Newton, line-search ____________________________________________________________ End diagnostic information Max Line search Directional First-order Iter F-count f(x) constraint steplength derivative optimality Procedure 0 5 -1725.47 -9.98e-05 1 22 -1725.67 -9.978e-05 0.000244 -752 8.54e+03 2 35 -1725.94 -9.939e-05 0.00391 -184 1.08e+05 3 43 -1726.98 -0.0003173 0.125 -75.1 5.08e+03 4 56 -1727.28 -0.0003188 0.00391 -143 1.3e+04 5 65 -1728.25 -0.000345 0.0625 -44.1 6.56e+03 6 72 -1728.29 -0.0002615 0.25 -4.52 1.06e+04 7 80 -1728.34 -0.0002529 0.125 -10.3 1.2e+04 8 85 -1728.39 -0.0002914 1 -4.47 7.07e+03 9 90 -1728.4 -0.0002815 1 -1.77 5.65e+03 10 95 -1728.4 -0.000274 1 -1.79 2.31e+03 11 100 -1728.4 -0.0002747 1 -1.78 691 12 105 -1728.4 -0.0002763 1 -0.32 2.96 Hessian modified 13 110 -1728.4 -0.0002764 1 -0.0127 0.839 Hessian modified Local minimum possible. Constraints satisfied. fmincon stopped because the size of the current search direction is less than twice the selected value of the step size tolerance and constraints are satisfied to within the selected value of the constraint tolerance. No active inequalities.
Using the same data as in Example 1, the example sets 'Display' to 'off' and calls garchfit with no output arguments. garchfit then displays the final parameter estimates and standard errors, then produces a tiered plot:
spec = garchset('C',0,'K',0.0001,'GARCH',0.9,'ARCH',0.05); rng('default') % make output reproducible [e,s,y] = garchsim(spec,1000); spec = garchset(spec,'Display','off'); garchfit(spec, y);
Warning: Warning: GARCHSET will be removed in a future release. Use ARIMA, GARCH, EGARCH, and GJR models instead. Warning: Warning: GARCHSIM will be removed in a future release. Use SIMULATE of ARIMA, GARCH, EGARCH, and GJR models instead. Warning: Warning: GARCHSET will be removed in a future release. Use ARIMA, GARCH, EGARCH, and GJR models instead. Warning: GARCHFIT will be removed in a future release. Use ESTIMATE of ARIMA, GARCH, EGARCH, and GJR models instead. Mean: ARMAX(0,0,0); Variance: GARCH(1,1) Conditional Probability Distribution: Gaussian Number of Model Parameters Estimated: 4 Standard T Parameter Value Error Statistic ----------- ----------- ------------ ----------- C -0.0013525 0.0013368 -1.0118 K 0.00027658 0.00014948 1.8503 GARCH(1) 0.77864 0.10108 7.7031 ARCH(1) 0.07357 0.0286 2.5724 Log Likelihood Value: 1728.4
 Bollerslev, T. "A Conditionally Heteroskedastic Time Series Model for Speculative Prices and Rates of Return." Review of Economics and Statistics. Vol. 69, 1987, pp. 542–547.
 Bollerslev, T. "Generalized Autoregressive Conditional Heteroskedasticity." Journal of Econometrics. Vol. 31, 1986, pp. 307–327.
 Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.
 Enders, W. Applied Econometric Time Series. Hoboken, NJ: John Wiley & Sons, Inc., 1995.
 Engle, Robert F. "Autoregressive Conditional Heteroskedasticity with Estimates of the Variance of United Kingdom Inflation." Econometrica. Vol. 50, 1982, pp. 987–1007.
 Engle, Robert F., D. M. Lilien, and R. P. Robins. "Estimating Time Varying Risk Premia in the Term Structure: The ARCH-M Model." Econometrica. Vol. 59, 1987, pp. 391–407.
 Glosten, L. R., R. Jagannathan, and D. E. Runkle. "On the Relation between the Expected Value and the Volatility of the Nominal Excess Return on Stocks." The Journal of Finance. Vol. 48, No. 5, 1993, pp. 1779–1801.
 Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.
 Nelson, D. B. "Conditional Heteroskedasticity in Asset Returns: A New Approach." Econometrica. Vol. 59, 1991, pp. 347–370.