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.58261    6.03805  1.75132   8.70026  …  7.01383  9.79131  1.54797
 1.39082   16.5032   1.42088   4.71267     1.65991  1.66676  1.09095
 0.220534   2.31343  0.485793  2.41641     1.20635  2.80769  0.695675
pdf(D, u)
10-element Vector{Float64}:
 0.06420985590373443
 6.953460334680188e-5
 0.06243894789925842
 0.0005465231154799516
 0.0007990485847604896
 0.05267355669213456
 0.016626461849276453
 0.010710571517178724
 0.001448379178367683
 0.10116230105900094
cdf(D, u)
10-element Vector{Float64}:
 0.0365676475379908
 0.48950655499622275
 0.05517456387294343
 0.5479408679711798
 0.34416512028061397
 0.050468688407465954
 0.10629670798338774
 0.242695437191189
 0.3343455836604714
 0.032806690381940264

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