Learn R Programming

CDVine (version 1.4)

CDVineSim: Simulation from C- and D-vine copula models

Description

This function simulates from given C- and D-vine copula models.

Usage

CDVineSim(N, family, par, par2=rep(0,length(family)), type)

Arguments

N
Number of d-dimensional observations simulated.
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 pair-copula families with two parameters (t, BB1, BB6, BB7, BB8; default: par2 = rep(0,length(family))).
type
Type of the vine model: 1 or "CVine" = C-vine 2 or "DVine" = D-vine

Value

An N x d matrix of data simulated from the given C- or D-vine copula model.

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

CDVineLogLik, BiCopSim

Examples

Run this code
## Example 1: simulate from a 6-dimensional C-vine model 
## with Gaussian pair-copulas
d = 6
dd = d*(d-1)/2
fam1 = rep(1,dd)
par1 = c(0.2,0.69,0.73,0.22,-0.09,0.51,0.32,0.01,0.82,0.01,
         -0.2,-0.32,-0.19,-0.17,-0.06)
N = 100
U1 = CDVineSim(N,fam1,par1,type=1)
head(U1)

# calculate the log-likelihood
logLik = CDVineLogLik(U1,fam1,par1,type=1)
logLik$loglik


## Example 2: simulate from a 6-dimensional C-vine model 
## with Student t pair-copulas each with three degrees of freedom
fam2 = rep(2,dd)
par2 = rep(0.5,dd)
nu2 = rep(3,dd)
U2 = CDVineSim(N,fam2,par2,nu2,type=1)

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


## Example 3: simulate from a 6-dimensional D-vine model
## with Student t pair-copulas each with five degrees of freedom
fam3 = rep(2,dd)
par3 = rep(0.4,dd)
nu3 = rep(5,dd)
U3 = CDVineSim(N,fam3,par3,nu3,type=2)

# calculate the log-likelihood
logLik3 = CDVineLogLik(U3,fam3,par3,nu3,type=2)
logLik3$loglik

Run the code above in your browser using DataLab