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}:
 2.26095   4.85919   10.9584   7.41187  …  10.1895   7.15072  8.74094
 2.63873   1.69721    1.71638  3.26404      2.99014  1.45016  3.41183
 0.296166  0.427796   1.18654  1.43575      3.0442   1.66178  0.535388
pdf(D, u)
10-element Vector{Float64}:
 0.011236324352283843
 0.02716119451554689
 0.004130312409387666
 0.0026873550196214423
 3.7653168603695174e-5
 3.2819125713224294e-5
 0.011760057296360852
 0.0005803921857135291
 0.007352657207862868
 0.0023006456309748423
cdf(D, u)
10-element Vector{Float64}:
 0.05706396299691282
 0.11163815652506628
 0.28234956460641586
 0.3903414192667678
 0.577818084993227
 0.6502770638792368
 0.18101800583566913
 0.5334197545499276
 0.22305861808917296
 0.20983645356176356

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