Brechmann
Brechmann
Brechmann
R-package VineCopula
Eike Christian Brechmann
[email protected]
Technische Universit
at M
unchen
1 / 26
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.
2 / 26
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.
2 / 26
Scope of VineCopula
VineCopula provides functions for bivariate analysis...
graphical tools
analytical tools
BiCop...
RVine...
model selection
illustration of vine trees
General assumption: Data lies in the unit hypercube [0, 1]d .
Eike Brechmann (TUM)
3 / 26
Scope of VineCopula
VineCopula provides functions for bivariate analysis...
graphical tools
analytical tools
BiCop...
RVine...
model selection
illustration of vine trees
General assumption: Data lies in the unit hypercube [0, 1]d .
Eike Brechmann (TUM)
3 / 26
Scope of VineCopula
VineCopula provides functions for bivariate analysis...
graphical tools
analytical tools
BiCop...
RVine...
model selection
illustration of vine trees
General assumption: Data lies in the unit hypercube [0, 1]d .
Eike Brechmann (TUM)
3 / 26
4 / 26
5 / 26
5 / 26
5 / 26
5 / 26
5 / 26
5 / 26
5 / 26
5 / 26
Rotation of copulas
I Rotate Archimedean copulas to capture negative dependence:
if (U1 , U2 ) C90 , then (1 U1 , U2 ) C0 .
6 / 26
Rotation of copulas
I Rotate Archimedean copulas to capture negative dependence:
if (U1 , U2 ) C90 , then (1 U1 , U2 ) C0 .
0.0
0.2
0.4
0.6
u1
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
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
6 / 26
7 / 26
7 / 26
> 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
0.01
$upper
[1] 0.68
7 / 26
4
3
T1
Density
c = c14 c15 c24 c34
c25;134
8 / 26
1,5
5
2,4
3,4
1,4
1
4
T1
Density
c = c14 c15 c24 c34
c23;14 c35;14
c25;134
8 / 26
1,5
5
2,4
3,4
1,4
1
4
T1
Density
2,4
1,5
1,4
3,4
c23;14 c35;14
c25;134
8 / 26
1,5
5
2,4
3,4
1,4
1
4
T1
Density
2,4
1,5
1,4
3,4
c23;14 c35;14
c25;134
8 / 26
1,5
5
2,4
3,4
1,4
1
4
T1
Density
1,2|4
2,4
4,5|1
1,5
1,4
1,3|4
3,4
T2
c23;14 c35;14
c25;134
8 / 26
1,5
5
2,4
3,4
1,4
1
4
T1
Density
1,2|4
2,4
4,5|1
1,5
1,4
1,3|4
4,5|1
1,3|4
3,4
1,2|4
T2
c23;14 c35;14
c25;134
T3
8 / 26
1,5
2,4
3,4
1,4
4
T1
Density
2,4
1,2|4
4,5|1
1,5
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
8 / 26
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
3,5|14
4,5|1
{2, 5|314}
2,3|14
1,3|4
1,2|4
2,5|134
3,5|14
2,3|14
T2
T3
T4
9 / 26
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
3,5|14
4,5|1
{2, 5|314}
2,3|14
1,3|4
1,2|4
2,5|134
3,5|14
2,3|14
T2
T3
T4
9 / 26
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
3,5|14
4,5|1
{2, 5|314}
2,3|14
1,3|4
1,2|4
2,5|134
3,5|14
2,3|14
T2
T3
T4
9 / 26
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
3,5|14
4,5|1
{2, 5|314}
2,3|14
1,3|4
1,2|4
2,5|134
3,5|14
2,3|14
T2
T3
T4
9 / 26
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
3,5|14
4,5|1
{2, 5|314}
2,3|14
1,3|4
1,2|4
2,5|134
3,5|14
2,3|14
T2
T3
T4
9 / 26
Copula families
2
5 3
3 5
1 1
4 4
C25;314
C23;14 C35;14
C21;4
C31;4 C45;1
5 5
C24
C34
C41 C51
1 1 1
10 / 26
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)
11 / 26
Simulation
V3
0.42
0.16
0.46
0.08
0.85
0.80
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
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.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
0.0
0.8
0.8
0.4
0.4
0.0
0.0
0.4
0.8
0.0
0.4
0.8
0.0
0.4
0.8
12 / 26
Example
13 / 26
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
0.4
0.8
0.0
0.4
0.8
0.0
0.4
0.8
14 / 26
Parameter estimation I
15 / 26
Parameter estimation II
16 / 26
Parameter estimation II
16 / 26
Parameter estimation II
16 / 26
Parameter estimation II
16 / 26
[,3]
0.00
0.00
0.00
1.42
0.52
[,2]
0.000
0.000
0.037
0.028
0.024
[,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
17 / 26
[,3]
0.00
0.00
0.00
1.42
0.52
[,2]
0.000
0.000
0.037
0.028
0.024
[,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
17 / 26
[,3]
0.00
0.00
0.00
1.42
0.52
[,2]
0.000
0.000
0.037
0.028
0.024
[,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
17 / 26
18 / 26
18 / 26
18 / 26
18 / 26
19 / 26
19 / 26
19 / 26
19 / 26
20 / 26
20 / 26
21 / 26
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
21 / 26
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
21 / 26
22 / 26
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
...
23 / 26
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
...
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
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
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)
25 / 26
Visit: http://cran.r-project.org/web/packages/VineCopula/
26 / 26