Vine based distributions — vine_distributions • rvinecopulib
Description: Density, distribution function and random generation for the vine based distribution.

# Vine based distributions

Source: `R/vine_methods.R`
`vine_methods.Rd`

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

    dvine(x, vine, cores = 1)

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

    rvine(n, vine, qrng = FALSE, cores = 1)

## 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"`.

cores

  number of cores to use; if larger than one, computations are done in parallel on `cores` batches .

n_mc

  number of samples used for quasi Monte Carlo integration.

n

  number of observations.

qrng

  if `TRUE`, generates quasi-random numbers using the multivariate Generalized Halton sequence up to dimension 300 and the Generalized Sobol sequence in higher dimensions (default `qrng = FALSE`).

## 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 custom vines (i.e., output of `vine_dist()`).

## Examples

    # 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
    )

    # set up vine copula model
    mat <- rvine_matrix_sim(3)
    vc <- vine_dist(list(distr = "norm"), pcs, mat)

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

    # evaluate the density and cdf
    dvine(x[1, ], vc)
    #> [1] 1.99482
    pvine(x[1, ], vc)
    #> [1] 1e-04