Brechmann

Download as pdf or txt
Download as pdf or txt
You are on page 1of 66

Statistical inference of vine copulas using the

R-package VineCopula
Eike Christian Brechmann
[email protected]

Technische Universit
at M
unchen

May 23, 2013

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

1 / 26

Available software for vines

In general...
I Uncertainty analysis with Correlations (UNICORN, TU Delft)
includes some functionality for vines.
In R...
I Packages for bivariate and multivariate copulas (copula, fCopulae,
QRMlib,...).
I Daniel Berg (U Oslo/NR): copulaGOF/CopulaLib.
The R-packages VineCopula and CDVine fill this gap.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

2 / 26

Available software for vines

In general...
I Uncertainty analysis with Correlations (UNICORN, TU Delft)
includes some functionality for vines.
In R...
I Packages for bivariate and multivariate copulas (copula, fCopulae,
QRMlib,...).
I Daniel Berg (U Oslo/NR): copulaGOF/CopulaLib.
The R-packages VineCopula and CDVine fill this gap.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

2 / 26

Scope of VineCopula
VineCopula provides functions for bivariate analysis...
graphical tools
analytical tools

BiCop...

selection and estimation of bivariate copulas


simulation of bivariate copulas
...and for multivariate analysis using (simplified) regular vine copulas.
sequential and joint maximum likelihood estimation
simulation of vine copulas

RVine...

model selection
illustration of vine trees
General assumption: Data lies in the unit hypercube [0, 1]d .
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

3 / 26

Scope of VineCopula
VineCopula provides functions for bivariate analysis...
graphical tools
analytical tools

BiCop...

selection and estimation of bivariate copulas


simulation of bivariate copulas
...and for multivariate analysis using (simplified) regular vine copulas.
sequential and joint maximum likelihood estimation
simulation of vine copulas

RVine...

model selection
illustration of vine trees
General assumption: Data lies in the unit hypercube [0, 1]d .
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

3 / 26

Scope of VineCopula
VineCopula provides functions for bivariate analysis...
graphical tools
analytical tools

BiCop...

selection and estimation of bivariate copulas


simulation of bivariate copulas
...and for multivariate analysis using (simplified) regular vine copulas.
sequential and joint maximum likelihood estimation
simulation of vine copulas

RVine...

model selection
illustration of vine trees
General assumption: Data lies in the unit hypercube [0, 1]d .
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

3 / 26

The package CDVine

Functionality for the sub-classes of C- and D-vines.


Links to the package VineCopula: C2RVine and D2RVine.
Vignette:
Brechmann & Schepsmeier (2013).
Modeling dependence with C- and D-vine copulas:
The R-package CDVine.
Journal of Statistical Software 52(3), 127.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

4 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas:
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas:

Two parameter Archimedean copulas:

Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.


Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas:
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas:
family = 3 Clayton copula
family = 4 Gumbel copula
family = 5 Frank copula
family = 6 Joe copula
Two parameter Archimedean copulas:

Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.


Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas:
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas:
family = 3 Clayton copula
family = 4 Gumbel copula
family = 5 Frank copula
family = 6 Joe copula
Two parameter Archimedean copulas:
family = 7 Clayton-Gumbel (BB1) copula
family = 8 Joe-Gumbel (BB6) copula
family = 9 Joe-Clayton (BB7) copula
family = 10 Joe-Frank (BB8) copula
Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas:
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas:
family = 13 survival Clayton copula
family = 14 survival Gumbel copula
family = 5 Frank copula
family = 16 survival Joe copula
Two parameter Archimedean copulas:
family = 17 survival BB1 copula
family = 18 survival BB6 copula
family = 19 survival BB7 copula
family = 20 survival BB8 copula
Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas:
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas:
family = 23 rotated Clayton copula (90 degrees)
family = 24 rotated Gumbel copula (90 degrees)
family = 5 Frank copula
family = 26 rotated Joe copula (90 degrees)
Two parameter Archimedean copulas:
family = 27 rotated BB1 copula (90 degrees)
family = 28 rotated BB6 copula (90 degrees)
family = 29 rotated BB7 copula (90 degrees)
family = 30 rotated BB8 copula (90 degrees)
Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas:
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas:
family = 33 rotated Clayton copula (270 degrees)
family = 34 rotated Gumbel copula (270 degrees)
family = 5 Frank copula
family = 36 rotated Joe copula (270 degrees)
Two parameter Archimedean copulas:
family = 37 rotated BB1 copula (270 degrees)
family = 38 rotated BB6 copula (270 degrees)
family = 39 rotated BB7 copula (270 degrees)
family = 40 rotated BB8 copula (270 degrees)
Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas: (parameters: par, par2 (degrees of freedom))
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas: (parameter: par)
family = 33 rotated Clayton copula (270 degrees)
family = 34 rotated Gumbel copula (270 degrees)
family = 5 Frank copula
family = 36 rotated Joe copula (270 degrees)
Two parameter Archimedean copulas: (parameters: par, par2)
family = 37 rotated BB1 copula (270 degrees)
family = 38 rotated BB6 copula (270 degrees)
family = 39 rotated BB7 copula (270 degrees)
family = 40 rotated BB8 copula (270 degrees)
Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

The building blocks: Bivariate copula families


Each family is denoted by a number to shorten notation (0 = indep.).
Elliptical copulas: (parameters: par, par2 (degrees of freedom))
family = 1 Gaussian copula
family = 2 Students t copula
One parameter Archimedean copulas: (parameter: par)
family = 33 rotated Clayton copula (270 degrees)
family = 34 rotated Gumbel copula (270 degrees)
family = 5 Frank copula
family = 36 rotated Joe copula (270 degrees)
Two parameter Archimedean copulas: (parameters: par, par2)
family = 37 rotated BB1 copula (270 degrees)
family = 38 rotated BB6 copula (270 degrees)
family = 39 rotated BB7 copula (270 degrees)
family = 40 rotated BB8 copula (270 degrees)
Density, distribution & h-functions: BiCopPDF, BiCopCDF & BiCopHfunc.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

5 / 26

Rotation of copulas
I Rotate Archimedean copulas to capture negative dependence:
if (U1 , U2 ) C90 , then (1 U1 , U2 ) C0 .

I Survival copulas correspond to rotation by 180 degrees.

Clayton copulas rotated by 0, 90, 180 and 270 degrees


>
>
>
>

dat0 = BiCopSim(N=500, family=3, par=2)


dat90 = BiCopSim(N=500, family=23, par=-2)
dat180 = BiCopSim(N=500, family=13, par=2)
dat270 = BiCopSim(N=500, family=33, par=-2)

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

6 / 26

Rotation of copulas
I Rotate Archimedean copulas to capture negative dependence:
if (U1 , U2 ) C90 , then (1 U1 , U2 ) C0 .

I Survival copulas correspond to rotation by 180 degrees.

Clayton copulas rotated by 0, 90, 180 and 270 degrees


dat0 = BiCopSim(N=500, family=3, par=2)
dat90 = BiCopSim(N=500, family=23, par=-2)
dat180 = BiCopSim(N=500, family=13, par=2)
dat270 = BiCopSim(N=500, family=33, par=-2)

0.0

0.2

0.4

0.6
u1

Eike Brechmann (TUM)

0.8

1.0

0.0

0.2

0.4

0.6
u1

0.8

1.0

1.0

270 degrees

0.0

0.2

0.4

0.6
u1

The R-package VineCopula

0.8

0.8

1.0

0.6

u2

0.4

0.2

0.0

0.6

0.8

u2

0.8

180 degrees

1.0

0.4

1.0

0.6

0.2

u2

0.0

0.2

0.4

0.0

0.8
0.6
u2

90 degrees

0.4

0.2

1.0

0 degrees

0.0

>
>
>
>

0.0

0.2

0.4

0.6

0.8

1.0

u1

May 23, 2013

6 / 26

Two parameter Archimedean copulas


I The BB1 and the BB7 copula can model tail-asymmetric dependence
with different non-zero lower and upper tail dependence.
I Density expressions and derivatives are however numerically involved.

Clayton-Gumbel (BB1) copula


> BiCopPar2Tau(family=7,
+
par=0.25, par2=2.5)
[1] 0.64
> BiCopPar2TailDep(family=7,
+
par=0.25, par2=2.5)
$lower
[1] 0.33
$upper
[1] 0.68
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

7 / 26

Two parameter Archimedean copulas


I The BB1 and the BB7 copula can model tail-asymmetric dependence
with different non-zero lower and upper tail dependence.
I Density expressions and derivatives are however numerically involved.

Clayton-Gumbel (BB1) copula


> BiCopPar2Tau(family=7,
+
par=0.25, par2=2.5)
[1] 0.64
> BiCopPar2TailDep(family=7,
+
par=0.25, par2=2.5)
$lower
[1] 0.33
$upper
[1] 0.68
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

7 / 26

Two parameter Archimedean copulas


I The BB1 and the BB7 copula can model tail-asymmetric dependence
with different non-zero lower and upper tail dependence.
I Density expressions and derivatives are however numerically involved.

Clayton-Gumbel (BB1) copula


> BiCopPar2Tau(family=7,
+
par=0.25, par2=2.5)

> BiCopMetaContour(family=7,
+
par=0.25, par2=2.5)

0.2

0.15

0.1

0.05

$lower
[1] 0.33

> BiCopPar2TailDep(family=7,
+
par=0.25, par2=2.5)

[1] 0.64

Eike Brechmann (TUM)

0.01

$upper
[1] 0.68

The R-package VineCopula

May 23, 2013

7 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters
2
5

4
3

T1

Density
c = c14 c15 c24 c34

c12;4 c13;4 c45;1


c23;14 c35;14

c25;134

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

8 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters

1,5
5

2,4

3,4

1,4
1

4
T1

Density
c = c14 c15 c24 c34

c12;4 c13;4 c45;1

c23;14 c35;14

c25;134

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

8 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters

1,5
5

2,4

3,4

1,4
1

4
T1

Density
2,4

1,5

c12;4 c13;4 c45;1

1,4

3,4

Eike Brechmann (TUM)

c = c14 c15 c24 c34


T2

The R-package VineCopula

c23;14 c35;14

c25;134

May 23, 2013

8 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters

1,5
5

2,4

3,4

1,4
1

4
T1

Density
2,4

1,5

c12;4 c13;4 c45;1

1,4

3,4

Eike Brechmann (TUM)

c = c14 c15 c24 c34


T2

The R-package VineCopula

c23;14 c35;14

c25;134

May 23, 2013

8 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters

1,5
5

2,4

3,4

1,4
1

4
T1

Density
1,2|4

2,4

c = c14 c15 c24 c34

4,5|1
1,5

c12;4 c13;4 c45;1

1,4
1,3|4

Eike Brechmann (TUM)

3,4

T2

The R-package VineCopula

c23;14 c35;14

c25;134

May 23, 2013

8 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters

1,5
5

2,4

3,4

1,4
1

4
T1

Density
1,2|4

2,4

c = c14 c15 c24 c34

4,5|1
1,5

c12;4 c13;4 c45;1

1,4
1,3|4

4,5|1

Eike Brechmann (TUM)

1,3|4

3,4

1,2|4

T2

c23;14 c35;14

c25;134

T3

The R-package VineCopula

May 23, 2013

8 / 26

Reminder: R-vine copulas


Three components: vine trees, pair copulas, copula parameters

1,5

2,4

3,4

1,4

4
T1

Density
2,4

1,2|4

c = c14 c15 c24 c34

4,5|1
1,5

c12;4 c13;4 c45;1

1,4
1,3|4
3,5|14

4,5|1

3,4

2,3|14
1,3|4

1,2|4

2,5|134
3,5|14
Eike Brechmann (TUM)

2,3|14

T2

c23;14 c35;14
c25;134

T3

T4

The R-package VineCopula

May 23, 2013

8 / 26

Storing R-vine copulas in matrix notation


Efficient enconding of R-vine models needed for statistical inference.
I Matrix notation by Morales-Napoles et al. (2010) and Dimann et al.
(2013).

2
5
3
1
4

3
5 4
1 5 5
4 1 1 1

1,5
5

2,4

3,4

1,4
1

1,2|4

2,4

1,3|4

3,4

T1

4,5|1
1,5

1
2
3
4

1,4

{2, 4}, {3, 4}, {4, 1}, {5, 1}


{2, 1|4}, {3, 1|4}, {4, 5|1}
{2, 3|14}, {3, 5|14}

3,5|14
4,5|1

{2, 5|314}

Eike Brechmann (TUM)

2,3|14
1,3|4

1,2|4

2,5|134
3,5|14

The R-package VineCopula

2,3|14

May 23, 2013

T2

T3

T4

9 / 26

Storing R-vine copulas in matrix notation


Efficient enconding of R-vine models needed for statistical inference.
I Matrix notation by Morales-Napoles et al. (2010) and Dimann et al.
(2013).

2
5
3
1
4

3
5 4
1 5 5
4 1 1 1

1,5
5

2,4

3,4

1,4
1

1,2|4

2,4

1,3|4

3,4

T1

4,5|1
1,5

1
2
3
4

1,4

{2, 4}, {3, 4}, {4, 1}, {5, 1}


{2, 1|4}, {3, 1|4}, {4, 5|1}
{2, 3|14}, {3, 5|14}

3,5|14
4,5|1

{2, 5|314}

Eike Brechmann (TUM)

2,3|14
1,3|4

1,2|4

2,5|134
3,5|14

The R-package VineCopula

2,3|14

May 23, 2013

T2

T3

T4

9 / 26

Storing R-vine copulas in matrix notation


Efficient enconding of R-vine models needed for statistical inference.
I Matrix notation by Morales-Napoles et al. (2010) and Dimann et al.
(2013).

2
5
3
1
4

3
5 4
1 5 5
4 1 1 1

1,5
5

2,4

3,4

1,4
1

1,2|4

2,4

1,3|4

3,4

T1

4,5|1
1,5

1
2
3
4

1,4

{2, 4}, {3, 4}, {4, 1}, {5, 1}


{2, 1|4}, {3, 1|4}, {4, 5|1}
{2, 3|14}, {3, 5|14}

3,5|14
4,5|1

{2, 5|314}

Eike Brechmann (TUM)

2,3|14
1,3|4

1,2|4

2,5|134
3,5|14

The R-package VineCopula

2,3|14

May 23, 2013

T2

T3

T4

9 / 26

Storing R-vine copulas in matrix notation


Efficient enconding of R-vine models needed for statistical inference.
I Matrix notation by Morales-Napoles et al. (2010) and Dimann et al.
(2013).

2
5
3
1
4

3
5 4
1 5 5
4 1 1 1

1,5
5

2,4

3,4

1,4
1

1,2|4

2,4

1,3|4

3,4

T1

4,5|1
1,5

1
2
3
4

1,4

{2, 4}, {3, 4}, {4, 1}, {5, 1}


{2, 1|4}, {3, 1|4}, {4, 5|1}
{2, 3|14}, {3, 5|14}

3,5|14
4,5|1

{2, 5|314}

Eike Brechmann (TUM)

2,3|14
1,3|4

1,2|4

2,5|134
3,5|14

The R-package VineCopula

2,3|14

May 23, 2013

T2

T3

T4

9 / 26

Storing R-vine copulas in matrix notation


Efficient enconding of R-vine models needed for statistical inference.
I Matrix notation by Morales-Napoles et al. (2010) and Dimann et al.
(2013).

2
5
3
1
4

3
5 4
1 5 5
4 1 1 1

1,5
5

2,4

3,4

1,4
1

1,2|4

2,4

1,3|4

3,4

T1

4,5|1
1,5

1
2
3
4

1,4

{2, 4}, {3, 4}, {4, 1}, {5, 1}


{2, 1|4}, {3, 1|4}, {4, 5|1}
{2, 3|14}, {3, 5|14}

3,5|14
4,5|1

{2, 5|314}

Eike Brechmann (TUM)

2,3|14
1,3|4

1,2|4

2,5|134
3,5|14

The R-package VineCopula

2,3|14

May 23, 2013

T2

T3

T4

9 / 26

R-vine copula and parameter matrices

Copula families

2
5 3

3 5

1 1
4 4

and parameters can be stored in associated matrices.

C25;314

C23;14 C35;14

C21;4

C31;4 C45;1
5 5
C24
C34
C41 C51
1 1 1

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

10 / 26

R-vine matrix objects


An RVineMatrix object contains all required matrices:
>
+
>
>
>
+
>
>
>
+
>
>
>
>
>
+

Matrix = c(2,5,3,1,4,0,3,5,1,4,0,0,4,5,1,
0,0,0,5,1,0,0,0,0,1)
Matrix = matrix(Matrix,5,5)
family = c(0,1,3,4,4,0,0,3,4,1,0,0,0,4,1,
0,0,0,0,3,0,0,0,0,0)
family = matrix(family,5,5)
par = c(0,0.2,0.9,1.5,3.9,0,0,1.1,1.6,0.9,0,0,0,1.9,0.5,
0,0,0,0,4.8,0,0,0,0,0)
par = matrix(par,5,5)
par2 = matrix(0,5,5)
RVM = RVineMatrix(Matrix=Matrix, family=family, par=par,
par2=par2, names=c("V1","V2","V3","V4","V5"))
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

11 / 26

Simulation

> simdat = RVineSim(500, RVM)


> head(simdat)
V1
V2
[1,] 0.51 0.24
[2,] 0.23 0.14
[3,] 0.65 0.38
[4,] 0.43 0.18
[5,] 0.86 0.86
[6,] 0.71 0.71

V3
0.42
0.16
0.46
0.08
0.85
0.80

Eike Brechmann (TUM)

V4
0.33
0.12
0.29
0.08
0.86
0.68

V5
0.45
0.20
0.70
0.26
0.87
0.88

The R-package VineCopula

May 23, 2013

12 / 26

Simulation

V2

V3

V4

0.47

V5

0.8
0.4
0.0

0.44

0.74 0.70

0.31

0.8
0.4
0.0

0.72 0.60 0.62


0.0

Eike Brechmann (TUM)

0.78

0.8

0.43

0.4

0.0

V1

0.8

V5
0.45
0.20
0.70
0.26
0.87
0.88

0.4

V4
0.33
0.12
0.29
0.08
0.86
0.68

0.8

0.0

V3
0.42
0.16
0.46
0.08
0.85
0.80

0.4

> simdat = RVineSim(500, RVM)


> head(simdat)
V1
V2
[1,] 0.51 0.24
[2,] 0.23 0.14
[3,] 0.65 0.38
[4,] 0.43 0.18
[5,] 0.86 0.86
[6,] 0.71 0.71

0.0

0.8

0.8

0.4

0.4

0.0

0.0

0.4

The R-package VineCopula

0.8

0.0

0.4

0.8

0.0

May 23, 2013

0.4

0.8

12 / 26

Example

Daily log returns of 15 major German stocks.


Observed from January 2005 to August 2009 (1158 observations).
Time series are filtered using GARCH(1,1) with Students t
innovations.
Data set of standardized residuals transformed to [0,1].
Load into workspace:
> data(daxreturns)
Now: selection of trees, pair copulas and parameters in inverse order.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

13 / 26

A first look at the data

0.32

BAYN.DE

0.42

0.35

0.29

BMW.DE

0.43

0.38

0.30

0.49

DAI.DE

0.0

0.4

0.8

0.0

0.4

0.8

0.40

0.4

BAS.DE

0.0

0.8

0.8

0.8

0.4

0.0

0.4

0.40

0.0

0.4

0.8

0.8

ALV.DE

0.4

0.0

0.0

0.0

Eike Brechmann (TUM)

0.4

0.8

0.0

0.4

0.8

The R-package VineCopula

0.0

0.4

0.8

May 23, 2013

14 / 26

Parameter estimation I

Sequential estimation (based on BiCopEst)


either using bivariate inversion of Kendalls :
> RVineSeqEst(data, RVM, method="itau")
or bivariate maximum likelihood estimation:
> RVineSeqEst(data, RVM, method="mle")

I Very fast, since only bivariate estimation.


I Provides good starting values for joint maximum likelihood estimation.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

15 / 26

Parameter estimation II

Maximum likelihood estimation of all parameters jointly


(log-likelihood computation: RVineLogLik).
> RVineMLE(data, RVM, start, start2, maxit,
+
grad, hessian, se)
I Starting values can be calculated using sequential estimation.
I Analytical gradient can be used for numerical optimization
(see RVineGrad).
I Standard errors can be computed based on the analytical Hessian
(see RVineStdError and RVineHessian).

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

16 / 26

Parameter estimation II

Maximum likelihood estimation of all parameters jointly


(log-likelihood computation: RVineLogLik).
> RVineMLE(data, RVM, start=0, start2=0, maxit,
+
grad, hessian, se)
I Starting values can be calculated using sequential estimation.
I Analytical gradient can be used for numerical optimization
(see RVineGrad).
I Standard errors can be computed based on the analytical Hessian
(see RVineStdError and RVineHessian).

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

16 / 26

Parameter estimation II

Maximum likelihood estimation of all parameters jointly


(log-likelihood computation: RVineLogLik).
> RVineMLE(data, RVM, start, start2, maxit,
+
grad=TRUE, hessian, se)
I Starting values can be calculated using sequential estimation.
I Analytical gradient can be used for numerical optimization
(see RVineGrad).
I Standard errors can be computed based on the analytical Hessian
(see RVineStdError and RVineHessian).

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

16 / 26

Parameter estimation II

Maximum likelihood estimation of all parameters jointly


(log-likelihood computation: RVineLogLik).
> RVineMLE(data, RVM, start, start2, maxit,
+
grad, hessian=TRUE, se=TRUE)
I Starting values can be calculated using sequential estimation.
I Analytical gradient can be used for numerical optimization
(see RVineGrad).
I Standard errors can be computed based on the analytical Hessian
(see RVineStdError and RVineHessian).

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

16 / 26

Parameter estimation III


> mle = RVineMLE(data=daxreturns[,1:5], RVM, start=0, start2=0,
+
grad=TRUE, hessian=TRUE, se=TRUE)
> mle$RVM$par
[,1] [,2]
[1,] 0.00 0.000
[2,] 0.14 0.000
[3,] 0.70 0.079
[4,] 1.30 1.206
[5,] 1.42 0.366
> mle$se
[,1]
[1,] 0.000
[2,] 0.029
[3,] 0.059
[4,] 0.031
[5,] 0.032

[,3]
0.00
0.00
0.00
1.42
0.52

[,2]
0.000
0.000
0.037
0.028
0.024

Eike Brechmann (TUM)

[,4] [,5]
0.00
0
0.00
0
0.00
0
0.00
0
0.99
0

[,3]
0.000
0.000
0.000
0.036
0.020

[,4] [,5]
0.000
0
0.000
0
0.000
0
0.000
0
0.059
0
The R-package VineCopula

May 23, 2013

17 / 26

Parameter estimation III


> mle = RVineMLE(data=daxreturns[,1:5], RVM, start=0, start2=0,
+
grad=TRUE, hessian=TRUE, se=TRUE)
> mle$RVM$par
[,1] [,2]
[1,] 0.00 0.000
[2,] 0.14 0.000
[3,] 0.70 0.079
[4,] 1.30 1.206
[5,] 1.42 0.366
> mle$se
[,1]
[1,] 0.000
[2,] 0.029
[3,] 0.059
[4,] 0.031
[5,] 0.032

[,3]
0.00
0.00
0.00
1.42
0.52

[,2]
0.000
0.000
0.037
0.028
0.024

Eike Brechmann (TUM)

[,4] [,5]
0.00
0
0.00
0
0.00
0
0.00
0
0.99
0

[,3]
0.000
0.000
0.000
0.036
0.020

[,4] [,5]
0.000
0
0.000
0
0.000
0
0.000
0
0.059
0
The R-package VineCopula

May 23, 2013

17 / 26

Parameter estimation III


> mle = RVineMLE(data=daxreturns[,1:5], RVM, start=0, start2=0,
+
grad=TRUE, hessian=TRUE, se=TRUE)
> mle$RVM$par
[,1] [,2]
[1,] 0.00 0.000
[2,] 0.14 0.000
[3,] 0.70 0.079
[4,] 1.30 1.206
[5,] 1.42 0.366
> mle$se
[,1]
[1,] 0.000
[2,] 0.029
[3,] 0.059
[4,] 0.031
[5,] 0.032

[,3]
0.00
0.00
0.00
1.42
0.52

[,2]
0.000
0.000
0.037
0.028
0.024

Eike Brechmann (TUM)

[,4] [,5]
0.00
0
0.00
0
0.00
0
0.00
0
0.99
0

[,3]
0.000
0.000
0.000
0.036
0.020

[,4] [,5]
0.000
0
0.000
0
0.000
0
0.000
0
0.059
0
The R-package VineCopula

May 23, 2013

17 / 26

Pair copula selection


Manually using tools for bivariate analysis (e.g., contour plots or
goodness-of-fit tests: BiCopMetaContour, BiCopGofTest,...).
Automatically using AIC or BIC from a set of copula families:
BiCopSelect (bivariate) or RVineCopSelect (multivariate).
> cops = RVineCopSelect(data=daxreturns[,1:5], familyset=NA,
+
Matrix=Matrix, selectioncrit="AIC",
+
indeptest=FALSE, level=0.05)
> cops$family
[,1] [,2] [,3] [,4] [,5]
[1,]
0
0
0
0
0
[2,]
5
0
0
0
0
[3,]
2
5
0
0
0
[4,]
2
20
2
0
0
[5,]
17
2
14
20
0
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

18 / 26

Pair copula selection


Manually using tools for bivariate analysis (e.g., contour plots or
goodness-of-fit tests: BiCopMetaContour, BiCopGofTest,...).
Automatically using AIC or BIC from a set of copula families:
BiCopSelect (bivariate) or RVineCopSelect (multivariate).
> cops = RVineCopSelect(data=daxreturns[,1:5], familyset=NA,
+
Matrix=Matrix, selectioncrit="AIC",
+
indeptest=FALSE, level=0.05)
> cops$family
[,1] [,2] [,3] [,4] [,5]
[1,]
0
0
0
0
0
[2,]
5
0
0
0
0
[3,]
2
5
0
0
0
[4,]
2
20
2
0
0
[5,]
17
2
14
20
0
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

18 / 26

Pair copula selection


Manually using tools for bivariate analysis (e.g., contour plots or
goodness-of-fit tests: BiCopMetaContour, BiCopGofTest,...).
Automatically using AIC or BIC from a set of copula families:
BiCopSelect (bivariate) or RVineCopSelect (multivariate).
> cops = RVineCopSelect(data=daxreturns[,1:5], familyset=NA,
+
Matrix=Matrix, selectioncrit="AIC",
+
indeptest=FALSE, level=0.05)
> cops$family
[,1] [,2] [,3] [,4] [,5]
[1,]
0
0
0
0
0
[2,]
5
0
0
0
0
[3,]
2
5
0
0
0
[4,]
2
20
2
0
0
[5,]
17
2
14
20
0
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

18 / 26

Pair copula selection


Manually using tools for bivariate analysis (e.g., contour plots or
goodness-of-fit tests: BiCopMetaContour, BiCopGofTest,...).
Automatically using AIC or BIC from a set of copula families:
BiCopSelect (bivariate) or RVineCopSelect (multivariate).
> cops = RVineCopSelect(data=daxreturns[,1:5], familyset=NA,
+
Matrix=Matrix, selectioncrit="AIC",
+
indeptest=FALSE, level=0.05)
> cops$family
[,1] [,2] [,3] [,4] [,5]
[1,]
0
0
0
0
0
[2,]
5
0
0
0
0
[3,]
2
5
0
0
0
[4,]
2
20
2
0
0
[5,]
17
2
14
20
0
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

18 / 26

Vine tree selection I


Sequential tree-by-tree selection according to Dimann et al. (2013):
Select maximum spanning tree (respecting the proximity condition) in
terms of the absolute empirical pairwise Kendalls values.
2 Select and estimate pair copulas of the tree.
3 Compute transformed observations using h-functions and go back to
Step 1.
1

I R- and C-vine copulas can be selected.


I The vine copula can be truncated to reduce the model complexity.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

19 / 26

Vine tree selection I


Sequential tree-by-tree selection according to Dimann et al. (2013):
Select maximum spanning tree (respecting the proximity condition) in
terms of the absolute empirical pairwise Kendalls values.
2 Select and estimate pair copulas of the tree.
3 Compute transformed observations using h-functions and go back to
Step 1.
1

> RVineStructureSelect(data, familyset, type,


+
selectioncrit, indeptest,
+
level, trunclevel)
I R- and C-vine copulas can be selected.
I The vine copula can be truncated to reduce the model complexity.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

19 / 26

Vine tree selection I


Sequential tree-by-tree selection according to Dimann et al. (2013):
Select maximum spanning tree (respecting the proximity condition) in
terms of the absolute empirical pairwise Kendalls values.
2 Select and estimate pair copulas of the tree.
3 Compute transformed observations using h-functions and go back to
Step 1.
1

> RVineStructureSelect(data, familyset, type="RVine",


+
selectioncrit, indeptest,
+
level, trunclevel)
I R- and C-vine copulas can be selected.
I The vine copula can be truncated to reduce the model complexity.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

19 / 26

Vine tree selection I


Sequential tree-by-tree selection according to Dimann et al. (2013):
Select maximum spanning tree (respecting the proximity condition) in
terms of the absolute empirical pairwise Kendalls values.
2 Select and estimate pair copulas of the tree.
3 Compute transformed observations using h-functions and go back to
Step 1.
1

> RVineStructureSelect(data, familyset, type,


+
selectioncrit, indeptest,
+
level, trunclevel=2)
I R- and C-vine copulas can be selected.
I The vine copula can be truncated to reduce the model complexity.

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

19 / 26

Vine tree selection II

> rvm = RVineStructureSelect(data=daxreturns)


> rvm$Matrix
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15]
[1,]
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
[2,]
11
4
0
0
0
0
0
0
0
0
0
0
0
0
0
[3,]
9
11
3
0
0
0
0
0
0
0
0
0
0
0
0
[4,]
7
9
11
11
0
0
0
0
0
0
0
0
0
0
0
[5,]
13
7
9
12
9
0
0
0
0
0
0
0
0
0
0
[6,]
3
13
7
8
12
7
0
0
0
0
0
0
0
0
0
[7,]
12
3
13
10
8
12
13
0
0
0
0
0
0
0
0
[8,]
8
12
5
5
10
8
12
5
0
0
0
0
0
0
0
[9,]
10
8
1
2
5
10
8
12
1
0
0
0
0
0
0
[10,]
2
10
12
13
2
5
10
8
12
12
0
0
0
0
0
[11,]
1
2
8
9
13
2
5
10
8
10
8
0
0
0
0
[12,]
14
1
6
7
1
13
2
2
10
6
10
10
0
0
0
[13,]
6
14
14
14
14
1
14
1
2
14
6
6
2
0
0
[14,]
4
6
10
6
6
14
6
14
14
2
14
14
6
14
0
[15,]
5
5
2
1
7
6
1
6
6
8
2
2
14
6
6

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

20 / 26

Vine tree selection II

> rvm = RVineStructureSelect(data=daxreturns)


> rvm$Matrix
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] [,15]
[1,]
15
0
0
0
0
0
0
0
0
0
0
0
0
0
0
[2,]
11
4
0
0
0
0
0
0
0
0
0
0
0
0
0
[3,]
9
11
3
0
0
0
0
0
0
0
0
0
0
0
0
[4,]
7
9
11
11
0
0
0
0
0
0
0
0
0
0
0
[5,]
13
7
9
12
9
0
0
0
0
0
0
0
0
0
0
[6,]
3
13
7
8
12
7
0
0
0
0
0
0
0
0
0
[7,]
12
3
13
10
8
12
13
0
0
0
0
0
0
0
0
[8,]
8
12
5
5
10
8
12
5
0
0
0
0
0
0
0
[9,]
10
8
1
2
5
10
8
12
1
0
0
0
0
0
0
[10,]
2
10
12
13
2
5
10
8
12
12
0
0
0
0
0
[11,]
1
2
8
9
13
2
5
10
8
10
8
0
0
0
0
[12,]
14
1
6
7
1
13
2
2
10
6
10
10
0
0
0
[13,]
6
14
14
14
14
1
14
1
2
14
6
6
2
0
0
[14,]
4
6
10
6
6
14
6
14
14
2
14
14
6
14
0
[15,]
5
5
2
1
7
6
1
6
6
8
2
2
14
6
6

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

20 / 26

Illustrating R-vine copula models


Selected R-vine trees:
> RVineTreePlot(data=NULL, RVM=rvm, tree=1,
+
edge.labels=c("family","theotau"))

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

21 / 26

Illustrating R-vine copula models


Selected R-vine trees:
> RVineTreePlot(data=NULL, RVM=rvm, tree=1,
+
edge.labels=c("family","theotau"))
Tree 1

FME.DE
SBB1,0.22
VOW3.DE
RWE.DE

t,0.35

DTE.DE

t,0.55

SBB8,0.34

DAI.DE
t,0.44
t,0.48

EOAN.DE

BMW.DE
DBK.DE
t,0.45

t,0.37
SIE.DE
t,0.43
BAS.DE
t,0.4

t,0.52

LIN.DE
t,0.42
BAYN.DE

ALV.DE
t,0.37
t,0.52

SAP.DE

MUV2.DE

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

21 / 26

Illustrating R-vine copula models


Selected R-vine trees:
> RVineTreePlot(data=NULL, RVM=rvm, tree=2,
+
edge.labels=FALSE)
Tree 2

DTE.DE,FME.DE
ALV.DE,MUV2.DE
DBK.DE,DTE.DE
ALV.DE,DBK.DE
BAS.DE,BAYN.DE

ALV.DE,SAP.DE
DBK.DE,SIE.DE

BAS.DE,LIN.DE
BAS.DE,SIE.DE
DAI.DE,DBK.DE

BAS.DE,EOAN.DE

BMW.DE,DAI.DE
DAI.DE,VOW3.DE

EOAN.DE,RWE.DE

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

21 / 26

Discrimination among vine copula models I

AIC and BIC: RVineAIC and RVineBIC.


Tests by Vuong (1989) and by Clarke (2007) for non-nested
comparisons of two R-vine models RVM1 and RVM2:
> RVineVuongTest(data, RVM1, RVM2)
> RVineClarkeTest(data, RVM1, RVM2)

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

22 / 26

Discrimination among vine copula models II


Select a C-vine copula for comparison:
> cvm = RVineStructureSelect(daxreturns, type="CVine")

Compare the models in terms of AIC values and the Vuong test:
> c(RVineAIC(daxreturns,rvm)$AIC, RVineAIC(daxreturns,cvm)$AIC)
[1] -9808.44 -9804.42
> RVineVuongTest(daxreturns, rvm, cvm)
$statistic
[1] 0.27
$statistic.Akaike
[1] 0.068
$statistic.Schwarz
[1] -0.44
...

The models are essentially indistinguishable.


Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

23 / 26

Discrimination among vine copula models II


Select a C-vine copula for comparison:
> cvm = RVineStructureSelect(daxreturns, type="CVine")

Compare the models in terms of AIC values and the Vuong test:
> c(RVineAIC(daxreturns,rvm)$AIC, RVineAIC(daxreturns,cvm)$AIC)
[1] -9808.44 -9804.42
> RVineVuongTest(daxreturns, rvm, cvm)
$statistic
[1] 0.27
$statistic.Akaike
[1] 0.068
$statistic.Schwarz
[1] -0.44
...

The models are essentially indistinguishable.


Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

23 / 26

Outlook
Current projects and plans:
Move code from C to C++.
Parallelize numerical maximum likelihood estimation.
Implement asymmetric copulas (Tawn).
Bayesian estimation and model selection.
Thank you to my package coauthors: Ulf Schepsmeier & Jakob Stober

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

24 / 26

Outlook
Current projects and plans:
Move code from C to C++.
Parallelize numerical maximum likelihood estimation.
Implement asymmetric copulas (Tawn).
Bayesian estimation and model selection.
Thank you to my package coauthors: Ulf Schepsmeier & Jakob Stober

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

24 / 26

Bibliography
Brechmann, E. C. and C. Czado (2013).
Risk management with high-dimensional vine copulas: An analysis of the Euro Stoxx 50.
Statistics & Risk Modeling , forthcoming.
Brechmann, E. C. and U. Schepsmeier (2013).
Modeling dependence with C- and D-vine copulas: The R-package CDVine.
Journal of Statistical Software 52 (3), 127.
Clarke, K. A. (2007).
A simple distribution-free test for nonnested model selection.
Political Analysis 15 (3), 347363.
Dimann, J., E. C. Brechmann, C. Czado, and D. Kurowicka (2013).
Selecting and estimating regular vine copulae and application to financial returns.
Computational Statistics & Data Analysis 59 (1), 5269.
Morales-N
apoles, O., R. M. Cooke, and D. Kurowicka (2010).
About the number of vines and regular vines on n nodes.
Working paper .
Vuong, Q. H. (1989).
Ratio tests for model selection and non-nested hypotheses.
Econometrica 57 (2), 307333.
Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

25 / 26

Thank you very much for your attention!

Visit: http://cran.r-project.org/web/packages/VineCopula/

Eike Brechmann (TUM)

The R-package VineCopula

May 23, 2013

26 / 26

You might also like