Sklar's Distribution

Recall the following theorem from [9]:

Theorem (Sklar): For every random vector $\bm X$, there exists a copula $C$ such that

\[\forall \bm x\in \mathbb R^d, F(\bm x) = C(F_{1}(x_{1}),...,F_{d}(x_{d})).\]

The copula $C$ is uniquely determined on $\mathrm{Ran}(F_{1}) \times ... \times \mathrm{Ran}(F_{d})$, where $\mathrm{Ran}(F_i)$ denotes the range of the function $F_i$. In particular, if all marginals are absolutely continuous, $C$ is unique.

The implementation we have of this theorem allows building multivariate distributions by specifying separately their marginals and dependence structures as follows:

using Copulas, Distributions, Random
X₁ = Gamma(2,3)
X₂ = Pareto()
X₃ = LogNormal(0,1)
C = ClaytonCopula(3,0.7) # A 3-variate Clayton Copula with θ = 0.7
D = SklarDist(C,(X₁,X₂,X₃)) # The final distribution
SklarDist{ClaytonCopula{3, Float64}, Tuple{Distributions.Gamma{Float64}, Distributions.Pareto{Float64}, Distributions.LogNormal{Float64}}}(
C: ClaytonCopula{3, Float64}(
G: Copulas.ClaytonGenerator{Float64}(0.7)
)

m: (Distributions.Gamma{Float64}(α=2.0, θ=3.0), Distributions.Pareto{Float64}(α=1.0, θ=1.0), Distributions.LogNormal{Float64}(μ=0.0, σ=1.0))
)

Although the output is not formatted, the model is constructed, and can be used in different ways:

u = rand(D,10)
3×10 Matrix{Float64}:
 9.09639   5.69501  6.65257  1.99268   …  9.01475   9.28523  2.38429
 1.59514   1.11028  8.52458  1.02414      1.31161   3.77738  2.5762
 0.985054  1.82233  3.38314  0.308759     0.503862  4.20852  0.908357
pdf(D, u)
10-element Vector{Float64}:
 0.008533538620347511
 0.005591860705350712
 0.00012133300269438882
 0.28446104065725236
 0.001519841790886495
 0.020414534821389517
 5.671912740527495e-5
 0.016003486317889528
 0.00023681201118632596
 0.00706017692150864
cdf(D, u)
10-element Vector{Float64}:
 0.230230295755953
 0.08163258160412437
 0.5447335244294707
 0.013761540677414563
 0.41119042416988977
 0.1855524195013816
 0.7006446803851342
 0.11419200457496381
 0.5876102627896959
 0.12307046794159705

From this construction, the object D is a genuine multivariate random vector following Distributions.jl's API, and can be sampled (rand()), can have its probability density function and its distribution function evaluated (respectively pdf and cdf), etc.

Copulas.SklarDistType
SklarDist{CT,TplMargins}

Fields:

  • C::CT - The copula
  • m::TplMargins - a Tuple representing the marginal distributions

Constructor

SklarDist(C,m)

This function allows to construct a random vector specified, through the Sklar Theorem, by its marginals and its copula separately. See Sklar's theorem:

Theorem (Sklar 1959): For every random vector $\bm X$, there exists a copula $C$ such that

$\forall \bm x\in \mathbb R^d, F(\bm x) = C(F_{1}(x_{1}),...,F_{d}(x_{d})).$ The copula $C$ is uniquely determined on $\mathrm{Ran}(F_{1}) \times ... \times \mathrm{Ran}(F_{d})$, where $\mathrm{Ran}(F_i)$ denotes the range of the function $F_i$. In particular, if all marginals are absolutely continuous, $C$ is unique.

The obtain random vector follows Distributions.jl's API and can be sampled, pdf and cdf can be evaluated, etc... We even provide a fit function. See the folowing exemple code :

using Copulas, Distributions, Random
X₁ = Gamma(2,3)
X₂ = Pareto()
X₃ = LogNormal(0,1)
C = ClaytonCopula(3,0.7) # A 3-variate Clayton Copula with θ = 0.7
D = SklarDist(C,(X₁,X₂,X₃)) # The final distribution

simu = rand(D,1000) # Generate a dataset

# You may estimate a copula using the `fit` function:
D̂ = fit(SklarDist{ClaytonCopula,Tuple{Gamma,Normal,LogNormal}}, simu)

References:

  • [9] Sklar, M. (1959). Fonctions de répartition à n dimensions et leurs marges. In Annales de l'ISUP (Vol. 8, No. 3, pp. 229-231).
  • [3] Nelsen, Roger B. An introduction to copulas. Springer, 2006.
source
[3]
R. B. Nelsen. An Introduction to Copulas. 2nd ed Edition, Springer Series in Statistics (Springer, New York, 2006).
[9]
A. Sklar. Fonctions de Repartition à n Dimension et Leurs Marges. Université Paris 8, 1–3 (1959).