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}:
 4.19016   1.76101  5.6942    14.9442   …  26.1171   3.63039  0.601909
 1.98831   2.4301   1.32203    4.47766      1.81309  2.00054  1.01231
 0.522036  1.84096  0.411011   1.97615      3.34687  1.35804  0.414475
pdf(D, u)
10-element Vector{Float64}:
 0.021775436971014122
 0.0014995253232754583
 0.04112624814849821
 0.0001954160451116256
 4.026393767934701e-5
 0.014207325333441653
 0.0003982686756307934
 1.1021029513856872e-5
 0.009796607047762956
 0.33446530613275477
cdf(D, u)
10-element Vector{Float64}:
 0.133696960119837
 0.0956610082679896
 0.08961587304790429
 0.59162607893398
 0.39495000556062604
 0.10643333250577419
 0.2098379354540944
 0.41778308400855746
 0.19460988741034518
 0.005144479065953915

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