Learn R Programming

rvinecopulib (version 0.2.8.1.0)

vine_distributions: Vine based distributions

Description

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

Usage

dvine(x, vine)

pvine(x, vine, n_mc = 10^4)

rvine(n, vine, U = NULL)

Arguments

x

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

vine

an object of class "vine_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 vine.

Value

dvine() gives the density, pvine() gives the distribution function, and rvine() generates random deviates.

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

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

Details

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

The functions are based on dvinecop(), pvinecop() and rvinecop() for vinecop objects, and either kde1d::dkde1d(), kde1d::pkde1d() and kde1d::qkde1d() for estimated vines (i.e., output of vine()), or the standard d/p/q-xxx from stats::Distributions for customly created vines (i.e., output of vine_dist())

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 <- vine_dist(list(name = "norm"), pcs, mat)

# simulate from the model
x <- rvine(200, vc)
pairs(x)

# evaluate the density and cdf
dvine(x[1, ], vc)
pvine(x[1, ], vc)
# }

Run the code above in your browser using DataLab