public abstract class ExtendedGARCH extends Object implements Serializable, Cloneable
The classical GARCH\((p,q)\) process \(\epsilon_t\) satisfies $$ \left\{ \begin{array}{ll} \epsilon_t = \sigma_t z_t & \\ \sigma_t^2 = Var(\epsilon_t|\epsilon_u, u \lt t) = \omega + \alpha(B)\epsilon^2_{t} + \beta(B)\sigma^2_{t} & \end{array} \right. $$ where \(\omega, \alpha_i, \beta_j\) are non-negative constants, \(\alpha(B)=\sum_{i=1}^q \alpha_iB^i\), \(\beta(B)=\sum_{j=1}^p \beta_jB^j\), and \(B\) is the backshift operator defined as \(B^jx_t = x_{t-j}\). The \(z_t\) are \(iid\) random variables where usually the distribution is assumed to be the normal distribution.
If \(y_t = \frac{p_t}{p_{t-1}}\) is the daily (percentage or log percentage)
return on a stock or stock index, the residuals \(\epsilon_t =
y_t - \mu_t \) may follow a GARCH process. Rather than being observed directly,
the process \(\epsilon_t\) may be the innovations of an ARMA(\(p^\prime,q^\prime\)) process.
That is, \( \Phi(B)y_t = \Theta(B)\epsilon_t\) where
\(\Phi(B) = 1 - \sum_{i=1}^{p^\prime} \phi_i B^i\) and \(\Theta(B) =
1-\sum_{j=1}^{q^{\prime}} \theta_j B^j\). The mean process \(\mu_t\) then can be
expressed as
$$ \mu_t = \mu + \sum_{i=1}^{p^\prime} \phi_i B^i y_t + \sum_{j=1}^{q^\prime}\theta_jB^j\epsilon_t$$
To estimate the mean model, an ARMA(\(p^\prime,q^\prime\)) is fit to the returns process.
See ExtendedGARCH.setMeanModel(int[])
.
The conditional variance
\(Var(\epsilon_t|\epsilon_u, u \lt t)=\sigma^2_t\) is known as
\(volatility\).
The GARCH model provides for inference and forecasting of market volatility
and captures certain artifacts such as fat tails and volatility clustering.
Autoregressive conditionally heteroscedastic (ARCH) models were introduced by
Engle (1982) and their generalized version (Generalized ARCH, or GARCH) is
due to Bollerslev (1986). See the class GARCH
for
further information.
Some features of real market data are not captured by the classical model. For example, it is often observed that market drops result in higher volatility than market increases, an asymmetric behavior known as leverage. A number of extensions to the standard model have been proposed to account for characteristics like leverage.
Extensions to the standard GARCH model have $$ \left\{ \begin{array}{ll} \epsilon_t = \sigma_t z_t & \\ h(\sigma_t) = \omega + I(B)g(\epsilon_{t}) + \beta(B)h(\sigma_{t}) & \end{array} \right. $$ where the functions \(h_t = h(\sigma_t)\) and \(g_t=g(\epsilon_t)\) are specified. Note that in this treatment, \(g(\epsilon_t)\) depends on the set of parameters \(\{\alpha_i\}\) and possibly others, and \(I(B)=\sum_{i=1}^q B^i\).
In addition, a mean model can be specified through an ARMA(\(p^{\prime},q^{\prime})\) model on the returns process as described above. The ARMA parameters are jointly estimated with the GARCH parameters.
For example, the exponential GARCH (EGARCH) puts $$ \left\{ \begin{array}{ll}
\epsilon_t = \sigma_tz_t & \\ \log \sigma_t^2 = \omega + I(B)
g(\epsilon_t,\sigma_t) + \beta(B)log(\sigma^2_{t}) & \end{array} \right.$$
where $$g(\epsilon_{t-k},\sigma_{t-k})=\alpha_k z_{t-k} + \gamma_k(|z_{t-k}|
- E|z_{t-k}|) $$ and \(\omega,\alpha_i,\beta_j,\) and \(\gamma_i\) are real
numbers. Estimation and forecasting for the exponential GARCH is provided in
class EGARCH
.
References
1. Bollerslev, T. (1986), Generalized Autoregressive Conditional
Heteroscedasticity, Journal of Econometrics, Volume 31, 307-327.
2. Engle, Robert F. (1982), Autoregressive Conditional Heteroscedasticity
with Estimates of the Variance of United Kingdom Inflation, Econometrica,
Volume 50, Issue 4, 987–1008.
Modifier and Type | Class and Description |
---|---|
static class |
ExtendedGARCH.Solver
An enumeration of the types of solvers available to the estimation
procedure.
|
static interface |
ExtendedGARCH.zDistribution
Public interface for specifying the distribution of \(z_t\).
|
Constructor and Description |
---|
ExtendedGARCH(TimeSeries ts,
int p,
int q,
int[] meanModel)
Constructor for the extended GARCH class.
|
Modifier and Type | Method and Description |
---|---|
abstract double |
conditionalVarianceFunction(double sigma2)
Abstract specification for the conditional variance \(\sigma^2_t\)
function.
|
abstract double |
conditionalVarianceInverseFunction(double f)
Abstract specification for the conditional variance \(\sigma^2_t\)
inverse function.
|
void |
estimate()
Performs the estimation for the specified model.
|
double |
filter(double[] parameters)
Performs filtering as specified by the conditional variance and the mean
model configuration using a set of fixed parameters.
|
double[][][] |
forecast(int numberOfSnapshots,
int numberOfStepsAhead)
Forecasts the conditional variance and the residual series for the fitted
extended GARCH model.
|
int |
getARCH()
Returns the value of the ARCH lag parameter for the given instance.
|
double[] |
getConditionalVariance()
Returns the current conditional variance array.
|
double[] |
getDataSeries()
Returns the data series, usually the time series of asset returns.
|
double |
getFinalLogLikelihood()
Returns the value of the log-likelihood at the final estimates of the
parameters.
|
int |
getGARCH()
Returns the value of the GARCH lag parameter for the given instance.
|
int[] |
getMeanModel()
Returns the mean ARMA model specification as an integer array,
\(\{p,d,q\}\).
|
double[] |
getMeanModelParameters()
Returns the current estimates of the mean model parameters.
|
int |
getNumberOfParameters()
Returns the number of parameters in the Extended GARCH model.
|
double[] |
getParameterLowerBounds()
Returns the parameter lower bounds.
|
double[] |
getParameters()
Returns the (current) parameter estimates of the extended GARCH object.
|
double[] |
getParameterUpperBounds()
Returns the parameter upper bounds.
|
double[] |
getResidualSeries()
Returns the epsilon series (the current residuals).
|
int |
getT()
Returns the length of the GARCH time series.
|
abstract double |
gFunction(double epsilon,
double sigma,
int lag,
double[] params,
double... values)
Abstract method for the function \(g(\epsilon_t,\sigma_t)\).
|
boolean |
isIncludeMean()
Returns the flag to include or not include an ARMA model for the mean.
|
boolean |
isMustEstimate()
Returns the value of
mustEstimateFlag . |
void |
setInitialConditionalVariance(double initialSigma2)
Sets the initial value of the conditional variance.
|
void |
setMaxNumberOfEvaluations(int maxEval)
Sets the maximum number of function evaluations to allow in the
Nelder-Mead method.
|
void |
setMeanModel(int[] meanModel)
Sets the mean ARMA model specification as an integer array \(\{p,d,q\}\),
where \(p\) is the number of AR lags and \(q\) is the number of MA lags.
|
void |
setMustEstimate(boolean mustEstimate)
Sets the value of
mustEstimateFlag . |
void |
setNumberOfParameters(int numberOfParameters)
Sets the number of parameters in the Extended GARCH model.
|
void |
setNumberOfThreads(int numberOfThreads)
Sets the number of
java.lang.Thread instances to be used for
parallel processing. |
void |
setParameterLowerBounds(double[] lowerBounds)
Sets the lower bounds for the parameter estimates.
|
void |
setParameters(double[] parameters)
Sets the values of the parameters.
|
void |
setParameterUpperBounds(double[] upperBounds)
Sets the upper bounds for the parameter estimates.
|
void |
setRandomObject(Random r)
Sets the random object.
|
void |
setSolverMethod(ExtendedGARCH.Solver solver)
Sets the solver to use for parameter estimation.
|
void |
setTolerance(double tolerance)
Sets the convergence tolerance.
|
void |
setValues(double[] values)
Sets the optional values needed in the specification for
gFunction . |
void |
setZDistribution(ExtendedGARCH.zDistribution userZDistribution)
Sets the distribution to use for the random variable, \(z\), in the
extended GARCH model.
|
public ExtendedGARCH(TimeSeries ts, int p, int q, int[] meanModel)
ts
- a TimeSeries
object containing the data series.
Typically the data series is the log or percentage daily returns for a
particular stock or stock index.p
- a non-negative int
, the GARCH order or number of
GARCH lagsq
- a non-negative int
, the ARCH order or number of
ARCH lagsmeanModel
- an int
array containing the specification
for the ARMA mean model optionally fit to the return series. Extending
classes should encode meanModel
=null
unless a
mean model is to be included.public void setRandomObject(Random r)
r
- a Random
object
Specifying a seed for the Random
object can produce
repeatable/deterministic output.
public int getGARCH()
int
, the value of p
public int getARCH()
int
, the value of q
public final int[] getMeanModel()
int
array containing the model specificationpublic final void setMeanModel(int[] meanModel)
meanModel
- an int
array of length 3 specifying the
ARMA model to fit to the return seriespublic void setZDistribution(ExtendedGARCH.zDistribution userZDistribution)
userZDistribution
- a zDistribution
object containing a
user defined distributionpublic final void setValues(double[] values)
gFunction
.values
- a double
array, containing the additional
valuespublic int getT()
int
, the length of the seriespublic final double[] getDataSeries()
double
array containing the data seriespublic final double[] getResidualSeries()
double
array containing the residualspublic void setSolverMethod(ExtendedGARCH.Solver solver)
solver
- a Solver
object. By default,
Solver
=QUASI_NEWTON
.public void setMaxNumberOfEvaluations(int maxEval)
maxEval
- a int
, the maximum number of function
evaluations
By default, maxEval
= 300.
public final double[] getConditionalVariance()
double
array containing the conditional variancepublic void setNumberOfThreads(int numberOfThreads)
java.lang.Thread
instances to be used for
parallel processing.numberOfThreads
- an int
specifying the number of
java.lang.Thread
instances to be used for parallel
processing.
Default: numberOfThreads
= 1.
public void setTolerance(double tolerance)
tolerance
- a double
containing the convergence
tolerance
By default, tolerance = 1.0e-8.
public final boolean isMustEstimate()
mustEstimateFlag
. A value of
true
means that the model parameter estimates are stale
given a recent configuration change, whereas a value of
false
means the estimates are up to date with the
configuration.boolean
, the value of the flagpublic void setMustEstimate(boolean mustEstimate)
mustEstimateFlag
.mustEstimate
- a boolean
, the setting of the flag. A
value of true
means that the model parameter estimates are
stale given a recent configuration change, whereas a value of
false
means the estimates are up to date with the
configuration.public final void setParameterUpperBounds(double[] upperBounds)
mustEstimate
flag is set to true
within this
method.upperBounds
- a double
array containing upper bounds
for the parameter estimatespublic double[] getParameterUpperBounds()
double
array containing the upper boundspublic double[] getParameterLowerBounds()
double
array containing the lower boundspublic final void setParameterLowerBounds(double[] lowerBounds)
mustEstimate
flag is set to true
within this
method.lowerBounds
- a double
array containing lower bounds
for the parameter estimatespublic final boolean isIncludeMean()
false
, do not include a model for the
mean.boolean
, the flag to include the mean.public void setInitialConditionalVariance(double initialSigma2)
mustEstimate
flag is set to true
within this
method.initialSigma2
- a double
, the initial value of the
conditional variancepublic int getNumberOfParameters()
int
, the number of parameters in the modelpublic final void setNumberOfParameters(int numberOfParameters)
mustEstimate
flag is set to true
within this method.numberOfParameters
- an int
, the number of parameters
in the modelpublic final double[] getMeanModelParameters()
1 + meanModel[0] + meanModel[2]
and
contain ARMA parameters in the following order: \((\mu,\phi_1,...,\phi_{p^\prime},
\theta_1,...,\theta_{q^\prime})\), with \(p^\prime\)=meanModel[0]
and
\(q^\prime\)=meanModel[2]
. A
null
array is returned if none have been estimated.double
array containing the mean model parameter
estimatespublic double[] getParameters()
mustEstimate
is true
, a warning is
printed. A null array is allowed on return so that extending classes can
set default values. The order of the parameters contained in the array will
depend on the implementation. For example, EGARCH (@link com.imsl.stat.EGARCH} returns
\((\omega, \alpha_1, \alpha_2, ...,\alpha_q, \beta_1,...,\beta_p, \gamma_1,...,\gamma_q) \),
where \(\{\beta_i, i=1,...,p\}\) are the autoregressive parameters on
\(h(\sigma_t)\) and \(\{(\alpha_j,\gamma_j) j=1,...,q \}\) are the
parameters in \(g(z_t)\).double
array containing parameter estimatespublic void setParameters(double[] parameters)
parameters
- a double
array containing parameter valuespublic void estimate() throws Exception
Exception
public double getFinalLogLikelihood()
double
, the log-likelihood evaluated at the final
parameter estimatespublic double[][][] forecast(int numberOfSnapshots, int numberOfStepsAhead)
numberOfSnapshots
\( \lt T \) and \(h = 1,2,...,\)
numberOfStepsAhead
, a forecast at time \(T-i+h\)
is the conditional expectation given the data to time \(T-i\).numberOfSnapshots
- an int
, the number of snapshotsnumberOfStepsAhead
- an int
, the number of steps aheaddouble
array of dimension numberOfSnapshots
by numberOfStepsAhead
by 2
containing the
forecasts for the innovations process (or residuals) and the conditional variance.
For \(i = 1,...,\)numberOfSnapshots
and \(h = 1,2,...,\)numberOfStepsAhead
forecasts[i-1][h-1][0]
is
the forecast for the residual and forecasts[i-1][h-1][1]
is
the forecast for the conditional variance.public abstract double conditionalVarianceFunction(double sigma2)
sigma2
- a double
, the value of \(\sigma^2_t\)double
, the value of the conditional variance
function at \(\sigma^2_t\)public abstract double conditionalVarianceInverseFunction(double f)
f
- a double
, the value of the conditional variance
function at \(\sigma^2_t\)double
, the value of \(\sigma^2_t\)public abstract double gFunction(double epsilon, double sigma, int lag, double[] params, double... values)
epsilon
- a double
, the value of \(\epsilon_{t-k}\)sigma
- a double
, the value of \(\sigma_{t-k}\)lag
- an int
, the lag \(k\)params
- a double
array containing parameter values for
time \(t-k\)values
- a double
object containing additional values
as needed by the implementationdouble
, the function valuepublic double filter(double[] parameters)
parameters
- a double
array containing fixed parameter
valuesdouble
, the value of the log-likelihood at the
given parameter valuesCopyright © 2020 Rogue Wave Software. All rights reserved.