>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_GARCH



The IMSL_GARCH function computes estimates of the parameters of a IMSL_GARCH(p,q) model.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

The Generalized Autoregressive Conditional Heteroskedastic (IMSL_GARCH) model is defined as:

where zt’s are independent and identically distributed standard normal random variables:

The above model is denoted as IMSL_GARCH(p,q). The p is the autoregressive lag and the q is the moving average lag. When βi = 0, i = 1,2,…,p, the above model reduces to ARCH(q) which was proposed by Engle (1982). The non-negativity conditions on the parameters implied a nonnegative variance and the condition on the sum of the βi’s and αi’s is required for wide sense stationarity.

In the empirical analysis of observed data, IMSL_GARCH(1,1) or IMSL_GARCH(1,2) models have often found to appropriately account for conditional heteroskedasticity (Palm 1996). This finding is similar to linear time series analysis based on IMSL_ARMA models.

It is important to notice that for the above models positive and negative past values have a symmetric impact on the conditional variance. In practice, many series may have strong asymmetric influence on the conditional variance. To take into account this phenomena, Nelson (1991) put forward Exponential IMSL_GARCH (EGARCH). Lai (1998) proposed and studied some properties of a general class of models that extended linear relationship of the conditional variance in ARCH and IMSL_GARCH into nonlinear fashion.

The maximal likelihood method is used in estimating the parameters in IMSL_GARCH(p,q). The log-likelihood of the model for the observed series {Yt} with length m is:

In the model, if q = 0, the model IMSL_GARCH is singular such that the estimated Hessian matrix H is singular.

The initial values of the parameter array x entered in array xguess must satisfy certain constraints. The first element of xguess refers to sigma and must be greater than zero and less than MAX_SIGMA. The remaining p + q initial values must each be greater than or equal to zero but less than one.

To guarantee stationarity in model fitting:

is checked internally. The initial values should be selected from the values between zero and one. The Aic is computed by:

2 * log(L) + 2 * (p+q+1)

where log(L) is the value of the log-likelihood function at the estimated parameters.

In fitting the optimal model, the subroutine IMSL_MINCONGEN, as well as its associated subroutines, are modified to find the maximal likelihood estimates of the parameters in the model. Statistical inferences can be performed outside the routine IMSL_GARCH based on the output of the log-likelihood function (LOG_LIKELIHOOD), the Akaike Information Criterion (AIC), and the variance-covariance matrix (VAR).


The data for this example are generated to follow a IMSL_GARCH(p,q) process by using a random number generation function SGARCH. The data set is analyzed and estimates of sigma, the AR parameters, and the MA parameters are returned. The values of the Log-likelihood function and the Akaike Information Criterion are returned from the output keywords LOG_LIKELIHOOD and AIC, respectively.

FUNCTION SGARCH, p, q, m, x z	=	FLTARR(m + 1000)
y0	=	FLTARR(m + 1000)
sigma	=	FLTARR(m + 1000)
z	=	IMSL_RANDOM(m + 1000, /Normal)
l	=	((p	>	q)	>	1)
y0(0:l - 1)	=	z(0:l - 1)*x(0)
; Compute the Initial Value Of Sigma s3	=	0.0
IF ((p	>	q) GE 1) THEN s3	=	TOTAL(x(1:p + q))
sigma(0:l - 1)	=	x(0)/(1.0 - s3) 
FOR i	=	l,	(m + 1000 - 1) DO BEGIN
  s1	=	0.0 
  s2	=	0.0
  FOR j	=	0,	q - 1	DO s1	=	s1 + x(j + 1) * $
    (y0(i - j - 1)^2)
  FOR j	=	0,	p - 1	DO s2	=	s2 + x(q + 1 + j) $
    * sigma(i - j - 1) 
sigma(i)	=	x(0) + s1 + s2 y0(i)	=	z(i)*SQRT(sigma(i))
; Discard the first 1000 Simulated Observations
RETURN,	y0(1000:*)
IMSL_RANDOMOPT, Set	=	182198625 
p	=	2
q	=	1
m	=	1000
x	=	[1.3, 0.2, 0.3, 0.4] xguess	=	[1.0, 0.1, 0.2, 0.3] y	=	SGARCH(p, q, m, x)
result	=	IMSL_GARCH(p, q, y, xguess, LOG_LIKELIHOOD = a, $
  AIC = aic)
PRINT, 'Sigma estimate is', result(0)
PRINT, 'AR(1) estimate is', result(1)
PRINT, 'AR(2) estimate is', result(2)
PRINT, 'MA(1) estimate is', result(3)
PRINT, 'Log-likelihood function value is', a
PRINT, 'Akaike Information Criterion value is', aic

IDL prints:

Sigma estimate is	1.27742
AR(1) estimate is	0.230132
AR(2) estimate is	0.375924
MA(1) estimate is	0.312843
Log-likelihood function value is	-2707.53
Akaike Information Criterion value is	5423.06


Result = IMSL_GARCH(p, q, y, xguess [, AIC=variable] [, /DOUBLE] [, LOG_LIKELIHOOD=variable] [, MAX_SIGMA=value] [, VAR=variable])

Return Value

One-dimensional array of length p + q + 1 containing the estimated values of sigma squared, the AR parameters, and the MA parameters.



Number of autoregressive (AR) parameters.


Number of moving average (MA) parameters.


One-dimensional array of length p + q + 1 containing the initial values for the parameter array x.


One-dimensional array containing the observed time series data.


AIC (optional)

Named variable into which the value of Akaike Information Criterion evaluated at the estimated parameter array x is stored.

DOUBLE (optional)

If present and nonzero, double precision is used.


Named variable into which the value of Log-likelihood function evaluated at the estimated parameter array x is stored.

MAX_SIGMA (optional)

Value of the upperbound on the first element (sigma) of the array of returned estimated coefficients. The default value is 10.

VAR (optional)

Named variable into which an array of size (p + q + 1) by (p + q + 1) containing the variance-covariance matrix is stored.

Version History



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us