Learn R Programming

rvinecopulib (version 0.2.6.1.1)

vinecop_distributions: Vine copula distributions

Description

Density, distribution function and random generation for the vine copula distribution.

Usage

dvinecop(u, vinecop)

pvinecop(u, vinecop, n_mc = 10^4)

rvinecop(n, vinecop, U = NULL)

Arguments

u

evaluation points, either a length d vector or a d-column matrix, where d is the number of variables in the vine.

vinecop

an object of class "vinecop_dist".

n_mc

number of samples used for quasi Monte Carlo integration.

n

number of observations.

U

optionally, an \(n \times d\) matrix of values in \((0,1)\). The result is then the inverse Rosenblatt transform of U; if U is a matrix of independent \(U(0, 1)\) variables, this simulates data from vinecop.

Value

dvinecop() gives the density, pvinecop() gives the distribution function, and rvinecop() generates random deviates.

The length of the result is determined by n for rvinecop(), and the number of rows in u for the other functions.

The vinecop object is recycled to the length of the result.

Details

See vinecop for the estimation and construction of vine copula models. Here, the density, distribution function and random generation for the vine copulas are standard.

The Rosenblatt transform (Rosenblatt, 1952) \(U = T(V)\) of a random vector \(V = (V_1,\ldots,V_d) ~ C\) is defined as $$ U_1 = V_1, U_2 = C(V_2|V_1), \ldots, U_d =C(V_d|V_1,\ldots,V_{d-1}), $$ where \(C(v_k|v_1,\ldots,v_{k-1})\) is the conditional distribution of \(V_k\) given \(V_1 \ldots, V_{k-1}, k = 2,\ldots,d\). The vector \(V\) are then independent standard uniform variables. The inverse operation $$ V_1 = U_1, V_2 = C^{-1}(U_2|U_1), \ldots, V_d =C^{-1}(U_d|U_1,\ldots,U_{d-1}), $$ can can be used to simulate from a copula. For any copula \(C\), if \(U\) is a vector of independent random variables, \(V = T^{-1}(U)\) has distribution \(C\).

Examples

Run this code
# NOT RUN {
# specify pair-copulas
bicop <- bicop_dist("bb1", 90, c(3, 2))
pcs <- list(
    list(bicop, bicop),  # pair-copulas in first tree 
    list(bicop)          # pair-copulas in second tree 
 )
 
# specify R-vine matrix
mat <- matrix(c(1, 2, 3, 1, 2, 0, 1, 0, 0), 3, 3) 

# set up vine copula model
vc <- vinecop_dist(pcs, mat)

# simulate from the model
u <- rvinecop(200, vc)
pairs(u)

# evaluate the density and cdf
dvinecop(u[1, ], vc)
pvinecop(u[1, ], vc)
# }

Run the code above in your browser using DataLab