Dependence measures
The copula of a random vector fully encodes its dependence structure. However, copulas are infinite-dimensional objects and interpreting their properties can be difficult as the dimension increases. Therefore, the literature has introduced quantifications of the dependence structure that may be used as univariate (imperfect but useful) summaries of certain copula properties. We implement the most well-known ones in this package.
Core dependence metrics τ, ρ, β, γ and ι
For a copula
For a copula
For a copula
where
For a copula
]:
with
where the normalizing constants depend only on the dimension
For a copula
It satisfies
]).
These dependence measures are very common when
Copulas.τ(),Copulas.ρ(),Copulas.β(),Copulas.γ()andCopulas.ι()provide the upper formulas, yielding a scalar whatever the dimension of the copula.StatsBase.corkendall(),StatsBase.corspearman(),Copulas.corblomqvist(),Copulas.corgini()andCopulas.corentropy()provide matrices of pairwise dependence metrics.All these functions have methods for a single argument
C::Copula, yielding theoretical quantities, and for a datasetdata::AbstractMatrixyielding empirical estimates.
For historical reasons, τ(data), ρ(data), β(data), γ(data), ι(data) require (d,n)-shaped datasets (observations or pseudo-observations), while corkendall(data), corspearman(data), corblomqvist(data), corgini(data), and corentropy(data) do require transposed (n,d)-shaped datasets.
Kendall's
0 if and only if the copula is a
IndependentCopula.-1 is and only if the copula is a
WCopula.1 if and only if the copula is a
MCopula.
They do not depend on the marginals. This is why we say that they measure the 'strength' of the dependency.
The package implements generic version of the dependence metrics, but some families have faster versions (closed form formulas or better integration paths). However, all the potential fast-paths are not implemented yet. If you feel a specific method for a certain copula is missing, do not hesitate to open an issue !
Many copula estimators are based on the relationship between parameters and these coefficients (see e.g., [ DocumenterCitations.CitationSiteNode("genest2011-cite-1")
– DocumenterCitations.CitationSiteNode("derumigny2017-cite-1")
]). Here is for example the relationship between the Kendall
using Copulas, Plots, Distributions
θs = -1:0.1:5
τs = [Copulas.τ(ClaytonCopula(2, θ)) for θ in θs]
plot(θs, τs; xlabel="θ", ylabel="τ", title="θ -> τ for bivariate Clayton", legend=false)
Remark the clear and easy to exploit bijection.
Pearson correlation and the Nataf correction
Pearson's linear correlation is deliberately absent from the list above: it is not a dependence measure in the copula sense, because it depends on the marginals and not only on the copula. The same copula produces different Pearson correlations under different marginals, while the rank-based measures are unchanged:
using Copulas, Distributions, Statistics, Random
rng = Xoshiro(1)
C = GaussianCopula([1.0 0.7; 0.7 1.0])
x₁ = rand(rng, SklarDist(C, (Normal(), Normal())), 10^5)
x₂ = rand(rng, SklarDist(C, (LogNormal(0, 0.8), LogNormal(0, 0.8))), 10^5)
(pearson_normal = cor(x₁[1, :], x₁[2, :]),
pearson_lognormal = cor(x₂[1, :], x₂[2, :]),
spearman_normal = Copulas.ρ(x₁),
spearman_lognormal = Copulas.ρ(x₂))(pearson_normal = 0.7004151620433605, pearson_lognormal = 0.6346874800791172, spearman_normal = 0.6829812427839137, spearman_lognormal = 0.6824427906110033)This is usually a reason to prefer the marginal-free measures. But some applications specify a target Pearson correlation for a random vector with given non-Gaussian marginals. For a Gaussian copula, the Nataf correction [ DocumenterCitations.CitationSiteNode("nataf1962-cite-1")
, DocumenterCitations.CitationSiteNode("liu1986-cite-1")
] computes the copula parameter matrix inducing that target:
m = (LogNormal(0, 0.8), LogNormal(0, 0.8))
D = SklarDist(GaussianCopula(2, Nataf(m, 0.7)), m)
cor(rand(rng, D, 10^5)') # ≈ 0.7 as requested.2×2 Matrix{Float64}:
1.0 0.69144
0.69144 1.0Note that the correction cannot work miracles: the attainable Pearson range of a pair of marginals is dictated by their Fréchet-Hoeffding bounds, so targets outside of it throw an error reporting the attainable range. See the elliptical copulas page for more details on the corresponding interface.
Tail dependency
Many people are interested in the tail behavior of their dependence structures. Tail coefficients summarize this tail behavior.
For a copula
Simetric tools can be constructed for the lower tail:
When
using Copulas, Distributions, Plots
λᵤ(C::Copulas.Copula{d}, u) where d = (1 - 2u - cdf(C, fill(u,d)))/(1-u)
χᵤ(C::Copulas.Copula{d}, u) where d = 2 * log1p(- u) / log1p(- 2u + cdf(C, fill(u,d))) - 1
C = GumbelCopula(2, 2.5)
plot(0.9:0.001:0.999, Base.Fix1(λᵤ, C); xlabel="u", label="λᵤ(u)", title="Graph of λᵤ(u) and χᵤ(u) for Gumbel Copula")
plot!(0.9:0.001:0.999, Base.Fix1(χᵤ, C); label="χᵤ(u)")
C = ClaytonCopula(2, 2.5)
plot(0.9:0.001:0.999, Base.Fix1(λᵤ, C); xlabel="u", label="λᵤ(u)", title="Graph of λᵤ(u) and χᵤ(u) for Clayton Copula")
plot!(0.9:0.001:0.999, Base.Fix1(χᵤ, C); label="χᵤ(u)")
All these coefficients quantify the behavior of the dependence structure, generally or in the extremes, and are therefore widely used in the literature either as verification tools to assess the quality of fits, or even as parameters. Many parametric copula families have simple surjections, injections, or even bijections between these coefficients and their parametrization, allowing matching procedures of estimation (similar to moment matching algorithms for fitting standard random variables).
The package provides both theoretical limits (for a given copula object) and empirical estimators (from data matrices). In addition, pairwise tail-dependence matrices can be computed for multivariate samples.
Theoretical λ:
Copulas.λₗ(C::Copula)andCopulas.λᵤ(C::Copula)Shortcuts:Copulas.λₗ(C),Copulas.λᵤ(C)Empirical λ:
Copulas.λₗ(U::AbstractMatrix; p=1/√m)andCopulas.λᵤ(U::AbstractMatrix; p=1/√m)Pairwise λ-matrix:
Copulas.coruppertail(data; method=:SchmidtStadtmueller, p=1/√m)andCopulas.corlowertail(data; method=:SchmidtStadtmueller, p=1/√m)
These follow the approach of Schmidt & Stadtmüller (see [ DocumenterCitations.CitationSiteNode("schmidt2006non-cite-1")
]).
References
J. Behboodian, A. Dolati and M. Úbeda-Flores. A multivariate version of Gini's rank association coefficient. Statistical Papers 48, 295–304 (2007).
J. Ma and Z. Sun. Mutual information is copula entropy. Tsinghua Science and Technology 16, 51–54 (2011).
C. Genest, J. Nešlehová and N. Ben Ghorbal. Estimators Based on Kendall's Tau in Multivariate Copula Models. Australian & New Zealand Journal of Statistics 53, 157–177 (2011).
G. A. Fredricks and R. B. Nelsen. On the Relationship between Spearman's Rho and Kendall's Tau for Pairs of Continuous Random Variables. Journal of Statistical Planning and Inference 137, 2143–2150 (2007).
A. Derumigny and J.-D. Fermanian. À propos des tests de l'hypothèse simplificatrice pour les copules conditionnelles. JDS2017, 6 (2017).
A. Nataf. Détermination des distributions de probabilités dont les marges sont données. Comptes Rendus de l'Académie des Sciences 255, 42–43 (1962).
P.-L. Liu and A. Der Kiureghian. Multivariate distribution models with prescribed marginals and covariances. Probabilistic Engineering Mechanics 1, 105–112 (1986).
R. Schmidt and U. Stadtmüller. Non-parametric estimation of tail dependence. Scandinavian journal of statistics 33, 307–335 (2006).