Learn R Programming

VineCopula (version 2.5.1)

RVineSim: Simulation from an R-Vine Copula Model

Description

This function simulates from a given R-vine copula model.

Usage

RVineSim(N, RVM, U = NULL)

Value

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

Arguments

N

Number of d-dimensional observations to simulate.

RVM

An RVineMatrix() object containing the information of the R-vine copula model. Optionally, a length-N list of RVineMatrix() objects sharing the same structure, but possibly different family/parameter can be supplied.

U

If not NULL(), an (N,d)-matrix of \(U[0,1]\) random variates to be transformed to the copula sample.

Author

Jeffrey Dissmann

References

Dissmann, J. F., 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), 52-69.

See Also

RVineMatrix(), BiCopSim()

Examples

Run this code

# define 5-dimensional R-vine tree structure matrix
Matrix <- c(5, 2, 3, 1, 4,
            0, 2, 3, 4, 1,
            0, 0, 3, 4, 1,
            0, 0, 0, 4, 1,
            0, 0, 0, 0, 1)
Matrix <- matrix(Matrix, 5, 5)

# define R-vine pair-copula family matrix
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)

# define R-vine pair-copula parameter matrix
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)

# define second R-vine pair-copula parameter matrix
par2 <- matrix(0, 5, 5)

# define RVineMatrix object
RVM <- RVineMatrix(Matrix = Matrix, family = family,
                   par = par, par2 = par2,
                   names = c("V1", "V2", "V3", "V4", "V5"))

# simulate a sample of size 300 from the R-vine copula model
set.seed(123)
simdata <- RVineSim(300, RVM)

Run the code above in your browser using DataLab