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:
using Pkg
Pkg.add(url="https://github.com/Santymax98/VineCopulas.jl")After registration in the General registry, installation will be:
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:
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.
u = [0.25, 0.50, 0.75]
logpdf(vine, u)-0.3912600300713141pdf(vine, u)0.6762042997240348Simulation
Simulation uses the inverse Rosenblatt transform internally.
rng = MersenneTwister(2026)
U = rand(rng, vine, 5)
size(U)(3, 5)U3×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.582707Rosenblatt round-trip
For a correctly specified vine with implemented inverse conditionals, inverse_rosenblatt(vine, rosenblatt(vine, U)) should recover U up to numerical tolerance.
Z = rosenblatt(vine, U)
U2 = inverse_rosenblatt(vine, Z)
maximum(abs.(U2 .- U))1.5543122344752192e-15Model summaries
VineCopulas.jl includes lightweight likelihood summaries for explicit models.
(loglikelihood(vine, U), npars(vine), aic(vine, U), bic(vine, U))(1.3211711868851, 3, 3.3576576262298, 2.1859713635321008)Next pages
Mathematical background explains why copulas and vines separate marginal modeling from dependence modeling.
h-functions and inverses explains the conditional primitives required by every pair-copula.
Supported pair-copula families gives the current support table.
Large simulation shows a larger synthetic workflow.