The DCC Package: Riccardo (Jack) Lucchetti Giulio Palomba Luca Pedini
The DCC Package: Riccardo (Jack) Lucchetti Giulio Palomba Luca Pedini
The DCC Package: Riccardo (Jack) Lucchetti Giulio Palomba Luca Pedini
Abstract
This package deals with the estimation of Dynamic Conditional Cor-
relation model (DCC) introduced by Engle (2002).
Notably, this model is generally estimated by a two-step approach:
the first step consists of the estimation of a battery of univariate GARCH
models in order to recover conditional variance parameters; in the second
step the conditional correlation likelihood is maximised with respect to
correlation parameters, conditionally on the estimated variance parame-
ters.
This package mainly deals with step 2: although one convenience func-
tion for step 1 is provided, it cannot be considered as a serious tool for
“production” work. Conversely, the estimation of the step-2 parameters
is carried out by numerical maximum likelihood with the option of em-
ploying advanced numerical techniques like analytical score and spherical
parametrisation.
1 The model
1.1 Notation
The dynamic conditional correlation (DCC) model by (Engle, 2002) is one of
the most popular multivariate GARCH models. It is suitable for analysing
and predicting the covolatility dynamics of asset returns given the information
available at time t − 1.
Denote an n-dimensional vector of observable series by yt and the informa-
tion set at time t − 1 by I t−1 ; in most cases, yt are market returns for a vector
of assets. We consider the mean-centred returns εt = yt − E (yt |I t−1 ) and we
assume they follow some unspecified conditional density with E(εt |I t−1 ) = 0n
and V ar(εt |I t−1 ) = Σt . The conditional covariance matrix can be split into
1/2 1/2
Σt = Vt Rt Vt , (1)
1
and the εt and vt vectors are treated as observable quantities. In practice,
a univariate GARCH-like model is customarily run for each series in the yt
vector and the GARCH residuals and estimated variances are used as observable
counterparts of εt and vt , respectively.
The dynamic correlation matrix is parametrised as
−1/2 −1/2
Rt = Q̃t Qt Q̃t ,
2
via Maximum Likelihood under a joint normality assumption.1 In order to
optimise numerical maximisation, this package uses analytical gradients (see
Caporin, Lucchetti and Palomba, 2020) and the spherical parametrisation for
dynamic correlation matrices adopted in Lucchetti and Pedini (2023).
3
realistically sized problem the most appropriate choice for step 1 is a battery of
identical models.
That said, this package provides, mostly as a convenience function that may
be used in teaching to abstract from the complexity of the real world, a function
called DCC_Step1(), which runs essentially a slight variation of the setup above,
that is an array of GARCH(1,1) models under the normality assumption for
each of the series yt , that should be contained in a list. The only difference is
that it is possible to endow Equation (7) with VAR-like dynamics, that is
p
X
yi,t = µi + βi yt−i + εi,t .
i=1
2 An example
In example script 1 we use the daily time series of the Nasdaq, DJ Eurostoxx
50, Nikkei and Bovespa market indices.2 Data ranges from January 5, 2000 to
February 19, 2019 (T = 4990 observations).
Step 1 is accomplished by estimating four GARCH(1,1) models, in which
one lag of all the returns is used as explanatory variables for the mean. The
estimated residuals and variances are then fed into the DCC_Setup() function;
the two additional arguments modeltype and has_target are used for choosing
the Cholesky specification (Equation (4)) and for indicating that the matrix Γ
should not be estimated, and the static correlation matrix of the standardised
residuals obtained after the first step (R) is used instead.
In this case, the DCC_Estimate() function is called with no second argu-
ment, which means that the default optimisation options will be used: analytical
derivatives, QML standard errors and medium verbosity. The code produces the
2 Example script Indices.inp.
4
set verbose off # turn off unwanted output
include DCC.gfn # include the package
list E = null
list H = null
loop foreach i Returns
garch 1 1 ; $i const Returns(-1) --quiet
e_$i = $uhat
E += e_$i
h_$i = $h
H += h_$i
endloop
5
listing below. The coefficients shown on output are those contained in vech(A)
and vech(B).
The next example introduces two changes: Step 1 is performed by the ded-
icated function DCC_Step1(), which achieves exactly the same effect as above.
Note that DCC_Step1() returns a bundle containing all Step 1 main informa-
tion: the matrices of residuals and conditional variances, for instance, can be
easily retrieved under the keys E and H. These must be then converted to lists
by using the mat2list() gretl function. Therefore, the lines
list E = null
list H = null
loop foreach i Returns
garch 1 1 ; $i const Returns(-1) --quiet
e_$i = $uhat
6
E += e_$i
h_$i = $h
H += h_$i
endloop
should be replaced by
scalar VAR_lags = 1
S1 = DCC_Step1(Returns, VAR_lags)
list E = mat2list(S1.E)
list H = mat2list(S1.H)
7
the DCC_Estimate() function, so as to force the usage of numerical derivatives.
The line
DCC_Estimate(&DModel)
thus changes to
bundle optim_opts = defbundle("analytical", 0)
DCC_Estimate(&DModel, optim_opts)
Scalar DCC
0.8
CondCorr_01_02
0.7 CondCorr_01_03
CondCorr_01_04
0.6
0.5
0.4
0.3
0.2
0.1
-0.1
20
20
20
20
20
20
20
20
20
20
00
02
04
06
08
10
12
14
16
18
-0
-0
-0
-0
-0
-0
-0
-0
-0
-0
1-
1-
1-
1-
1-
1-
1-
1-
1-
1-
01
01
01
01
01
01
01
01
01
01
8
list C = DCC_GetCorrel(DModel)
will populate the gretl workspace with the estimated conditional correlation.
The series names are CondCorr_01_02, CondCorr_01_03 and so on. Plotting
the estimated conditional correlations obtained for the Nasdaq index gives a
plot like the one shown in Figure 2.
Scalar DCC
9
where the matrix G is now characterised via n(n − 1)/2 angles ωi,j defined
between 0 and π. The transformation is invertible, so recovering correlations is
immediate. To further improve the maximisation convergence, ωi,j can be re-
expressed in unconstrained parameters θi,j using a logit function (reparm=1):
This transformation has the effect that the parameter space for θi,j is the entire
real line; this may be advantageous to overcome possible numerical problems
when sin(ωi,j ) ≃ 0.
The 1st stage residuals list obtained after the 1st step (list E, see section 1.2).
The variances list estimated via the 1st step (list H, see section 1.2).
Model type Here the choice is between 3 DCC models, namely the the Cholesky,
the Rank-1 and the scalar model (default).
Standard errors Here the choice is between 3 algorithms for computing the
covariance matrix of the estimated parameters, hence the standard errors.
Quasi Maximum Likelihood (also known as QMLE, see Bollerslev and
Wooldridge, 1992) is the default, but Hessian and OPG are also available.
10
Verbosity An integer, ranging from 0 to 2: the default is 1, which means that
BFGS iterations will printed. If 0, no output is printed (all results can be
retrieved later); if 2, the BFGS iterations are showed verbosely, which may
be helpful in some cases, especially when the algorithm fails to converge
(see also section 5).
The Boolean flags for analytical derivatives in score computation and for matrix
targeting in the second step estimation. They both default to 1, as already
mentioned in section 3.
Note that, if some lists are already defined, you can pick them from the
drop-down list; alternatively, you can create lists on the fly by using the “+”
button.
DCC_GetCorrel(bundle mod)
11
DCC_Printout(bundle mod)
Note that the function returns a bundle with the following keys: n for the
number of series; vn for the series names; E, the GARCH unstandardised residu-
als; H the estimated variances; coeff for the (np + 4) × n matrix with estimated
coefficients; llik, for the n-dimensional row vector containing the loglikelihoods
of the univariate models; crit for the n × 3 matrix containing the information
criteria.
12
4 Changelog
v 0.1 Initial release
References
Bollerslev, T. and J. M. Wooldridge (1992) ‘Quasi maximum likelihood estima-
tion and inference in dynamic models with time varying covariances’, Econo-
metric Review 11: 143–172.
Caporin, M., R. Lucchetti and G. Palomba (2020) ‘Analytical gradients of dy-
namic conditional correlation models’, Journal of Risk and Financial Man-
agement 13(3): 1–21.
Engle, R. (2002) ‘Dynamic conditional correlation: A simple class of multivariate
generalized autoregressive conditional heteroskedasticity models’, Journal of
Business & Economic Statistics 20(3): 339–350.
Engle, R. F. and J. Mezrich (1996) ‘GARCH for groups’, Risk 9: 36–40.
13