Skip to content

Getting started

This page gives the smallest complete workflow: install the package, build a D-vine, evaluate its density, simulate from it, and check the Rosenblatt round-trip.

Installation

Before registration, install directly from GitHub:

julia
using Pkg
Pkg.add(url="https://github.com/Santymax98/VineCopulas.jl")

After registration in the General registry, installation will be:

julia
using Pkg
Pkg.add("VineCopulas")

A minimal D-vine

A D-vine of dimension three needs two first-tree pair-copulas and one second-tree conditional pair-copula:

In code:

julia
using VineCopulas
using Distributions: logpdf, pdf
using Random

C12 = GaussianCopula([1.0 0.5; 0.5 1.0])
C23 = ClaytonCopula(2, 2.0)
C13_2 = FrankCopula(2, 3.0)

vine = DVineCopula(
    [1, 2, 3],
    [[C12, C23], [C13_2]],
)
DVineCopula(p=3, trunc=2)

The package uses the p × n convention for data matrices: rows are dimensions and columns are observations. A single point is a vector of length p.

julia
u = [0.25, 0.50, 0.75]
logpdf(vine, u)
-0.3912600300713141
julia
pdf(vine, u)
0.6762042997240348

Simulation

Simulation uses the inverse Rosenblatt transform internally.

julia
rng = MersenneTwister(2026)
U = rand(rng, vine, 5)
size(U)
(3, 5)
julia
U
3×5 Matrix{Float64}:
 0.851357  0.0460845  0.411695  0.0176404  0.585723
 0.606777  0.767878   0.112078  0.263401   0.670734
 0.758089  0.452605   0.221529  0.460221   0.582707

Rosenblatt round-trip

For a correctly specified vine with implemented inverse conditionals, inverse_rosenblatt(vine, rosenblatt(vine, U)) should recover U up to numerical tolerance.

julia
Z = rosenblatt(vine, U)
U2 = inverse_rosenblatt(vine, Z)
maximum(abs.(U2 .- U))
1.5543122344752192e-15

Model summaries

VineCopulas.jl includes lightweight likelihood summaries for explicit models.

julia
(loglikelihood(vine, U), npars(vine), aic(vine, U), bic(vine, U))
(1.3211711868851, 3, 3.3576576262298, 2.1859713635321008)

Next pages