Elliptical family
Definition
The easiest families of copulas are the one derived from known families of random vectors, and the first presented one are, generally, the Elliptical families (in particular, the Gaussian and Student families are very standard in the litterature).
A random vector
For every matrix
Spherical random vectors have several interesting properties. First, the shape of the distribution must be the same in every direction since it is stable by rotations. Moreover, their characteristic functions (c.f.) only depend on the norm of their arguments. Indeed, for any
We can therefore express this characteristic function as
This class contains the (multivariate) Normal and Student distributions, and it is easy to construct others if needed. This is a generalization of the family of Gaussian random vectors, and they benefit from several nice properties of the former, among which, particularly interesting, the stability by convolution. Indeed, convolutions correspond to product of characteristic functions, and
which is still a function of only the norm of
To fix ideas, for Gaussian random vectors,
Sampling with Distributions.jl
Elliptical random vectors in the Gaussian and Student families are available from Distributions.jl:
using Distributions
Σ = [1 0.5
0.5 1] # variance-covariance matrix.
ν = 3 # number of degrees of freedom for the student.
N = MvNormal(Σ)ZeroMeanFullNormal(
dim: 2
μ: Zeros(2)
Σ: [1.0 0.5; 0.5 1.0]
)T = MvTDist(ν,Σ)Distributions.GenericMvTDist{Float64, PDMats.PDMat{Float64, Matrix{Float64}, LinearAlgebra.Cholesky{Float64, Matrix{Float64}}}, FillArrays.Zeros{Float64, 1, Tuple{Base.OneTo{Int64}}}}(
df: 3.0
dim: 2
μ: Zeros(2)
Σ: [1.0 0.5; 0.5 1.0]
)Elliptical copulas are simply copulas of elliptical distributions. This simplicity of definition is paid for in the expression of the copulas itself: the obtained function has usually no better expression than:
where
and
Moreover, the form of dependence structures that can be reached inside this class is restricted. The elliptical copulas are parametrized by the corresponding univariate spherical generator and a correlation matrix, which is a very simple structure. See also [ DocumenterCitations.CitationSiteNode("frahm2003-cite-1")
– DocumenterCitations.CitationSiteNode("cote2019-cite-1")
] for details on these copulas.
On the other hand, there exist performant estimators of high-dimensional covariance matrices, and a large theory is built on the elliptical assumption of high dimensional random vectors, see e.g., [ DocumenterCitations.CitationSiteNode("elidan2013-cite-1")
– DocumenterCitations.CitationSiteNode("muller2019-cite-1")
] among others. See also [ DocumenterCitations.CitationSiteNode("derumigny2022-cite-1")
] for a recent work on nonparametric estimation of the underlying univariate spherical distribution.
You can obtain these elliptical copulas by the following code:
using Copulas
Σ = [1 0.5
0.5 1] # variance-covariance matrix.
ν = 3 # number of degrees of freedom for the student.
C_N = GaussianCopula(Σ)
C_T = TCopula(ν,Σ)Examples
To construct, e.g., a Student copula, you need to provide the Correlation matrix and the number of degree of freedom, as follows:
using Copulas, Distributions
Σ = [1 0.5
0.5 1] # variance-covariance matrix.
ν = 3 # number of degrees of freedom
C = TCopula(ν,Σ)TCopula{2, Float64}(Σ = [1.0 0.5; 0.5 1.0]))You can sample it and compute its density and distribution functions via the standard interface. We could try to fit a GaussianCopula on the sampled data, even if we already know that the tails will not be properly taken into account:
u = rand(C,200)
Ĉ = fit(GaussianCopula,u) # to fit on the sampled data.GaussianCopula{2, Float64}(Σ = [1.0 0.532250909090198; 0.532250909090198 1.0]))We see that the estimation we have on the correlation matrix is quite good, but rest assured that the tails of the distributions are not the same at all. To see that, let's plot the lower tail function (see [ DocumenterCitations.CitationSiteNode("nelsen2006-cite-1")
]) for both copulas:
using Plots
chi(C,u) = 2 * log(1-u) / log(1 - 2u + cdf(C,[u,u])) -1
u = 0.5:0.03:0.99
plot(u, chi.(Ref(C),u), label="True student copula")
plot!(u, chi.(Ref(Ĉ),u), label="Estimated Gaussian copula")
Visual: Gaussian vs Student (same correlation)
using Plots
Σ = [1 0.7; 0.7 1]
ν = 4
CG = GaussianCopula(Σ)
CT = TCopula(ν, Σ)
plot(plot(CG), plot(CT); layout=(1,2))
Conditional on original scale via SklarDist
XG = SklarDist(CG, (Normal(), Normal()))
XT = SklarDist(CT, (Normal(), Normal()))
X1G = condition(XG, 2, 0.0)
X1T = condition(XT, 2, 0.0)
xgrid = range(quantile(X1T, 0.001), quantile(X1T, 0.999); length=401)
plot(xgrid, Distributions.cdf.(Ref(X1G), xgrid); label="Gaussian", xlabel="x", ylabel="cdf",
title="F_{X1|X2=0}")
plot!(xgrid, Distributions.cdf.(Ref(X1T), xgrid); label="Student")
The difference between the two is not very strong.
Conditionals and distortions
For an elliptical copula built from an underlying elliptical vector
For the Gaussian copula, the conditional law
is Gaussian with Mapping to the copula scale with and yields the conditional copula via and the univariate conditional distortions For the Student-
copula with degrees of freedom , one uses the standard conditional- result: , where and . With $u_k = F_t(x_k;\,\nu)$ and $x_k = F_t^{-1}(u_k;\,\nu)$ (standard univariate $t$ with df $\nu$), this provides closed forms for $C_{I|J}$ and for $$H_{i|J}(u\mid\boldsymbol u_J) = F_t\!\Big(\,F_t^{-1}(u;\,\nu)\,;\,\mu_{i|J},\,\tfrac{\nu + r_J}{\nu + q_J}\,\Sigma_{i|J},\,\nu+|J|\Big),$$ where $q_J=|J|$, $r_J= x_J^\top\Sigma_{JJ}^{-1}x_J$, and $F_t(\cdot;\,\mu,\sigma^2,\nu)$ is the univariate non-standard $t$ CDF.
These formulas are what the implementation relies on (via SklarDist for original scale and via marginal CDF transforms for the copula scale) to compute condition and the associated distortions efficiently.
Available models
GaussianCopula
For a positive-definite correlation matrix
where GaussianCopula(Σ), GaussianCopula{d}(Σ), or GaussianCopula(d, Σ). The equicorrelation forms GaussianCopula{d}(ρ) and GaussianCopula(d, ρ) require
Kendall's tau and Spearman's rho of a Gaussian pair are fit(GaussianCopula, U; method=:itau) and method=:irho invert the sample coefficients in closed form, entry by entry, in every dimension. A pairwise matrix of inverted coefficients need not be positive definite above dimension 2; it is then shrunk toward the identity by the smallest amount that makes it one.
using Copulas, Random, StatsBase
C = GaussianCopula([1.0 0.6 0.3; 0.6 1.0 0.4; 0.3 0.4 1.0])
U = rand(Xoshiro(317), C, 2_000)
Ĉ = fit(GaussianCopula, U; method=:itau)
(Ĉ.Σ[1, 2], sinpi(corkendall(U')[1, 2] / 2))(0.5672922453836485, 0.5672922453836485)Targeting a Pearson correlation: the Nataf correction
The parameter matrix of a GaussianCopula is the correlation matrix of the underlying Gaussian random vector. When the copula is coupled to non-Gaussian marginals through SklarDist, that parameter is not the Pearson correlation of the resulting random vector, because Pearson correlation depends on the marginals (only rank-based measures such as Kendall's τ or Spearman's ρ are marginal-free, see the dependence measures page):
using Copulas, Distributions, Statistics, Random
rng = Xoshiro(1)
C = GaussianCopula([1.0 0.7; 0.7 1.0])
D = SklarDist(C, (LogNormal(0, 0.8), LogNormal(0, 0.8)))
cor(rand(rng, D, 10^5)') # although the copula parameter is 0.7...2×2 Matrix{Float64}:
1.0 0.631666
0.631666 1.0The Nataf correction [ DocumenterCitations.CitationSiteNode("nataf1962-cite-2")
, DocumenterCitations.CitationSiteNode("liu1986-cite-2")
] inverts this distortion: it computes the copula parameter matrix that makes the SklarDist attain a target Pearson correlation matrix for the given marginals:
m = (LogNormal(0, 0.8), LogNormal(0, 0.8))
R₀ = Nataf(m, [1.0 0.7; 0.7 1.0])2×2 Matrix{Float64}:
1.0 0.761043
0.761043 1.0D = SklarDist(GaussianCopula(R₀), m)
cor(rand(rng, D, 10^5)') # ≈ 0.7 as requested.2×2 Matrix{Float64}:
1.0 0.702896
0.702896 1.0Since non-Gaussian marginals cannot attain every Pearson correlation (the Fréchet-Hoeffding bounds of the pair), an unattainable target throws an error reporting the attainable range. Pairs among Normal, LogNormal, and Uniform margins use closed-form corrections; other marginals go through a Gauss-Hermite quadrature.
See the canonical Public API entry for Nataf.
TCopula
For degrees of freedom
Construct it with TCopula(ν, Σ), TCopula{d}(ν, Σ), or TCopula(d, ν, Σ).
For a bivariate Student copula, Copulas.ρ(C) evaluates Spearman's rank correlation using a one-dimensional integral rather than a generic copula cubature. The degrees of freedom affect Spearman's rho, whereas Kendall's tau depends only on the correlation parameter.
The multivariate CDF uses deterministic internal random streams, so repeated calls with the same arguments are reproducible. Its result nevertheless remains a numerical estimate rather than an exact probability.
Both rank coefficients can therefore identify the two bivariate parameters:
using Copulas, Distributions, Random
C = TCopula{2}(4.0, [1.0 0.55; 0.55 1.0])
U = rand(Xoshiro(316), C, 500)
Ĉ = fit(TCopula{2}, U; method=:itau_irho)
(df=first(params(Ĉ)), correlation=last(params(Ĉ))[1, 2])(df = 3.1811371506558497, correlation = 0.5529579797159047)This rank-matching method is bivariate. Near zero Kendall correlation, the degrees of freedom are not identifiable from these two rank coefficients; use maximum likelihood instead.
method=:itau is available in every dimension. Kendall's tau of an elliptical copula depends on the correlation alone, so the correlation matrix is the same closed-form inversion as for the Gaussian copula; the degrees of freedom are then the maximizer of the likelihood with that correlation held fixed, the profile that :mle runs without re-estimating the correlation at every
Ĉ = fit(TCopula, U; method=:itau)
(df=first(params(Ĉ)), correlation=last(params(Ĉ))[1, 2])(df = 3.772289433119053, correlation = 0.5529579797159047)See the canonical Public API for complete constructor validation and numerical behavior.
References
R. B. Nelsen. An Introduction to Copulas. 2nd ed Edition, Springer Series in Statistics (Springer, New York, 2006).
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).
G. Frahm, M. Junker and A. Szimayer. Elliptical Copulas: Applicability and Limitations. Statistics & Probability Letters 63, 275–286 (2003).
E. Gómez, M. A. Gómez-villegas and J. M. Marín. A Survey on Continuous Elliptical Vector Distributions. Revista Matemática Complutense 16, 345–361 (2003).
M.-P. Côté and C. Genest. Dependence in a Background Risk Model. Journal of Multivariate Analysis 172, 28–46 (2019).
G. Elidan. Copulas in Machine Learning. In: Copulae in Mathematical and Quantitative Finance, Vol. 213, edited by P. Jaworski, F. Durante and W. K. Härdle (Springer Berlin Heidelberg, Berlin, Heidelberg, 2013); pp. 39–60.
J. Friedman, T. Hastie and R. Tibshirani. Applications of the Lasso and Grouped Lasso to the Estimation of Sparse Graphical Models (Technical report, Stanford University, 2010).
D. Müller and C. Czado. Dependence Modelling in Ultra High Dimensions with Vine Copulas and the Graphical Lasso. Computational Statistics & Data Analysis 137, 211–232 (2019).
A. Derumigny and J.-D. Fermanian. Identifiability and Estimation of Meta-Elliptical Copula Generators. Journal of Multivariate Analysis, 104962 (2022).