CDVineLogLik: Log-likelihood of C- and D-vine copula models

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/CDVineLogLik.R

Description

This function calculates the log-likelihood of d-dimensional C- and D-vine copula models for a given copula data set.

Usage

1
2
CDVineLogLik(data, family, par, 
             par2=rep(0,dim(data)[2]*(dim(data)[2]-1)/2), type)

Arguments

data

An N x d data matrix (with uniform margins).

family

A d*(d-1)/2 integer vector of C-/D-vine pair-copula families with values
0 = independence copula
1 = Gaussian copula
2 = Student t copula (t-copula)
3 = Clayton copula
4 = Gumbel copula
5 = Frank copula
6 = Joe copula
7 = BB1 copula
8 = BB6 copula
9 = BB7 copula
10 = BB8 copula
13 = rotated Clayton copula (180 degrees; “survival Clayton”)
14 = rotated Gumbel copula (180 degrees; “survival Gumbel”)
16 = rotated Joe copula (180 degrees; “survival Joe”)
17 = rotated BB1 copula (180 degrees; “survival BB1”)
18 = rotated BB6 copula (180 degrees; “survival BB6”)
19 = rotated BB7 copula (180 degrees; “survival BB7”)
20 = rotated BB8 copula (180 degrees; “survival BB8”)
23 = rotated Clayton copula (90 degrees)
24 = rotated Gumbel copula (90 degrees)
26 = rotated Joe copula (90 degrees)
27 = rotated BB1 copula (90 degrees)
28 = rotated BB6 copula (90 degrees)
29 = rotated BB7 copula (90 degrees)
30 = rotated BB8 copula (90 degrees)
33 = rotated Clayton copula (270 degrees)
34 = rotated Gumbel copula (270 degrees)
36 = rotated Joe copula (270 degrees)
37 = rotated BB1 copula (270 degrees)
38 = rotated BB6 copula (270 degrees)
39 = rotated BB7 copula (270 degrees)
40 = rotated BB8 copula (270 degrees)

par

A d*(d-1)/2 vector of pair-copula parameters.

par2

A d*(d-1)/2 vector of second parameters for two parameter pair-copula families (default: par2 = rep(0,dim(data)[2]*(dim(data)[2]-1)/2)).

type

Type of the vine model:
1 or "CVine" = C-vine
2 or "DVine" = D-vine

Details

Let u=(u'_1,...,u'_N)' be d-dimensional observations with u_i=(u_{i,1},...,u_{i,d})' in [0,1]^d. Then the log-likelihood of a C-vine copula is given by

loglik:=l_{CVine}(θ|u)= ∑_{i=1}^N ∑_{j=1}^{d-1} ∑_{k=1}^{d-j} ln[c_{j,j+k|1,...,j-1}],

where

c_{j,j+k|1,...,j-1}:=c_{j,j+k|1:(j-1)}(F(u_{i,j}|u_{i,1},...,u_{i,j-1}),F(u_{i,j+k}|u_{i,1},...,u_{i,j-1})|θ_{j,j+k|1,...,j-1})

denote pair-copulas with parameter(s) θ_{j,j+k|1,...,j-1}.

Similarly, the log-likelihood of a d-dimensional D-vine copula is

loglik:=l_{DVine}(θ|u)= ∑_{i=1}^N ∑_{j=1}^{d-1} ∑_{k=1}^{d-j} ln[c_{k,k+j|k+1,...,k+j-1}],

again with pair-copula densities denoted by

c_{k,k+j|k+1,...,k+j-1}:=

c_{k,k+j|k+1,...,k+j-1}(F(u_{i,k}|u_{i,k+1},...,u_{i,k+j-1}),F(u_{i,k+j}|u_{i,k+1},...,u_{i,k+j-1})|θ_{k,k+j|k+1,...,k+j-1}).

Conditional distribution functions in both expressions are obtained recursively using the relationship

h(u|v,θ) := F(u|v) = \partial C_{uv_j|v_{-j}}(F(u|v_{-j}),F(v_j|v_{-j})) / \partial F(v_j|v_{-j}),

where C_{uv_j|v_{-j}} is a bivariate copula distribution function with parameter(s) θ and v_{-j} denotes a vector with the j-th component v_j removed. The notation of h-functions is introduced for convenience. For more details see Aas et al. (2009).

Note that both log-likelihoods can also be written as loglik=∑_{k=1}^{d(d-1)/2}ll_{k}, where ll_{k} are the individual contributions to the log-likelihood of each pair-copula.

Value

loglik

The calculated log-likelihood value of the C- or D-vine copula model.

ll

An array of individual contributions to the log-likelihood for each pair-copula. Note: loglik = sum(ll).

vv

The stored transformations (h-functions) which may be used for posterior updates.

Author(s)

Carlos Almeida, Ulf Schepsmeier

References

Aas, K., C. Czado, A. Frigessi, and H. Bakken (2009). Pair-copula constructions of multiple dependence. Insurance: Mathematics and Economics 44 (2), 182-198.

See Also

BiCopHfunc, CDVineMLE, CDVineAIC, CDVineBIC

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Example 1: 3-dimensional D-vine model with Gaussian pair-copulas
data(worldindices)
Data = as.matrix(worldindices)[,1:3]
fam1 = c(1,1,1) 
par1 = c(0.2,0.3,0.4)

# calculate the log-likelihood
logLik1 = CDVineLogLik(Data,fam1,par1,type=2)

# check the above formula
sum(logLik1$ll)
logLik1$loglik


## Example 2: 6-dimensional C-vine model with Student t pair-copulas
## with 5 degrees of freedom
data(worldindices)
Data = as.matrix(worldindices)
dd = dim(Data)[2]*(dim(Data)[2]-1)/2
fam2 = rep(2,dd)
par2 = rep(0.5,dd)
nu2 = rep(5,dd)

# calculate the log-likelihood
logLik2 = CDVineLogLik(Data,fam2,par2,nu2,type=1)
logLik2$loglik


## Example 3: 4-dimensional C-vine model with mixed pair-copulas
fam3 = c(5,1,3,14,3,2)
par3 = c(0.9,0.3,0.2,1.1,0.2,0.7)
nu3 = c(0,0,0,0,0,7)

# calculate the log-likelihood
logLik3 = CDVineLogLik(Data[,1:4],fam3,par3,nu3,type=2)
logLik3$loglik

Example output

The CDVine package is no longer developed actively.
Please consider using the more general VineCopula package
(see https://CRAN.R-project.org/package=VineCopula),
which extends and improves the functionality of CDVine.

[1] 12.18256
[1] 12.18256
[1] 645.4369
[1] 197.9972

CDVine documentation built on May 2, 2019, 9:28 a.m.