# simulate a sample of size 500 from a 4-dimensional D-vine
# copula model with mixed pair-copulas
# load package CDVine
library(CDVine)
d <- 4
dd <- d*(d-1)/2
order <- 1:d
family <- c(1, 2, 3, 4, 7, 3)
par <- c(0.5, 0.4, 2, 1.5, 1.2, 1.5)
par2 <- c(0, 5, 0, 0, 2, 0)
type <- 2
simdata <- CDVineSim(500, family, par, par2, type)
# determine log-likelihood
out <- CDVineLogLik(simdata, family, par, par2, type)
out$loglik
# transform to R-vine matrix notation
RVM <- D2RVine(order, family, par, par2)
# check that log-likelihood stays the same
out2 <- RVineLogLik(simdata, RVM)
out2$loglik
Run the code above in your browser using DataLab