Skip to content

Empirical models

Pseudo-observations

Through the statistical process leading to the estimation of copulas, one usually observes the data and information on the marginals scale and not on the copula scale. This discrepancy between the observed information and the modeled distribution must be taken into account. A key concept is that of pseudo-observations.

Definition: Pseudo-observations

If xRN×d is an N-sample of a d-variate real-valued random vector X, then the pseudo-observations are the normalized ranks of the marginals of x, defined in the absence of ties as:

u[0,1]N×d:ui,j=Rank(xi,j,x,j)N+1=1N+1k=1N1xk,jxi,j,

where Rank(y,x)=xix1xiy.

With tied observations, the rank convention becomes part of the estimator. pseudos uses average ranks by default, matching the usual R and vinecopulib convention. The ties keyword also provides :first, :last, :min, :max, and :random; the latter accepts an explicit rng for reproducibility. These choices agree when margins are tie-free. A tie convention does not, on its own, make inference designed for continuous margins valid for discrete data.

In Copulas.jl, the function pseudos implements this transformation directly.

See the canonical Public API entry for pseudos.

Deheuvel's empirical copula

From these pseudo-observations, an empirical copula is defined and anlysed in [ DocumenterCitations.CitationSiteNode("deheuvels1979-cite-1")

] as follows:

Definition: Deheuvel's empirical copula

The empirical distribution function of the normalized ranks,

C^N(u)=1Ni=1N1uiu,

is called the empirical copula function.

Theorem: Exhaustivity and consistency
C^N

is an exhaustive estimator of C, and moreover for any normalizing constants {ϕN,NN} such that limNϕNN1lnlnN=0,

limNϕNsupu[0,1]d|C^N(u)C(u)|=0 a.s.
C^N

then converges (weakly) to C, the true copula of the random vector X, when the number of observations N goes to infinity.

The empirical copula is not a true copula

Despite its name, C^N is not a genuine copula on the full unit cube since its finite-sample margins are step functions rather than continuous uniforms. EmpiricalCopula keeps its historical Copula subtype for API compatibility, while algorithms that require exact uniform margins recognize this exception explicitly.

In the package, this copula is implemented as the EmpiricalCopula:

See the canonical Public API entry for EmpiricalCopula.

Passing it directly to SklarDist is allowed, but emits a warning: the resulting distribution generally does not have the requested margins. For a genuine copula model, smooth the empirical function with BetaCopula, a valid BernsteinCopula, or CheckerboardCopula. The direct construction remains useful when the intended model is the atomic empirical distribution transformed onto new coordinate scales; in that case pdf and logpdf report point masses rather than Lebesgue densities.

Conditionals and distortions

  • Conditional distortions are defined by partial-derivative ratios. For the empirical copula, derivatives are stepwise; interpret results carefully near sample jumps.

  • Conditional copulas are available through condition.

Visual: empirical copula from pseudo-observations

julia
using Copulas, Distributions, Plots
# generate data with known dependence, then compute pseudo-observations
X = SklarDist(ClaytonCopula(2, 1.2), (Normal(), Beta(1, 4)))
x = rand(X, 1000)
Ĉ = EmpiricalCopula(x, pseudo_values=false)
plot(plot(first(params(X))), plot(Ĉ); layout=(1,2))

Beta copula

The empirical copula function is not a copula. An easy way to fix this problem is to smooth out the marginals with beta distribution functions. The Beta copula is thus defined and analysed in [ DocumenterCitations.CitationSiteNode("segers2017-cite-1")

] as follows:

Definition: Definition (Beta Copula)

Denoting Fn,r(x)=s=rn(ns)xs(1x)ns as the distribution function of a Beta(r,n+1r) random variable, the function

C^Nβ:x1Ni=1Nj=1dFn,(N+1)ui,j(xj)

is a genuine copula, called the Beta copula.

Property: Proximity of C^N and C^Nβ
supu[0,1]d|C^N(u)C^Nβ(u)|d(lnnn+1n+1n)

In the package, this copula is implemented as BetaCopula:

See the canonical Public API entry for BetaCopula.

Conditionals and distortions

  • Conditional distortions support efficient evaluation and sampling.

  • Conditional copulas are available through condition.

Performance notes

  • Construction is O(d·n) after pseudo-observations are computed. Evaluation at a point uses O(d·n) basis lookups; consider subsampling for very large n.

Bernstein Copula

Bernstein copula are simply another smoothing of the empirical copula using Bernstein polynomials.

Mathematically, given a base copula C and degrees m=(m1,,md), the (cdf) Bernstein copula is

Bm(C)(u)=s1=0m1sd=0mdC(s1m1,,sdmd)j=1d(mjsj)ujsj(1uj)mjsj.

It is a multivariate Bernstein polynomial approximation of C on the uniform grid. Larger mj increase smoothness and accuracy at higher computational cost. When the base is an empirical copula built from n tie-free observations, however, the result has exactly uniform margins if and only if every mj divides n [ DocumenterCitations.CitationSiteNode("segers2017-cite-2")

]. BernsteinCopula rejects degrees that violate this condition instead of returning a multivariate distribution mislabeled as a copula. With m=nothing, it selects the largest divisor of n no greater than n1/d.

The divisibility restriction is specific to the empirical construction. Applying the Bernstein operator to a genuine copula preserves uniform margins for arbitrary positive degrees. Constructors nevertheless verify the resulting cell masses, so tied empirical ranks or numerically invalid base values cannot silently produce a non-copula.

In the package, this copula is implemented as BernsteinCopula:

See the canonical Public API entry for BernsteinCopula.

Conditionals and distortions

  • Conditional distortions are obtained from the Bernstein grid conditioned on uJ and support evaluation and sampling.

  • Conditional copulas are available through condition.

Performance notes

  • Complexity grows with the grid size ∏_j (m_j+1) for cdf and ∏_j m_j for pdf. In higher dimensions, keep m small or prefer the 2D specialized paths provided.

  • The constructor tolerates floating-point roundoff in finite differences, but rejects materially negative cell masses or non-uniform margins.

Checkerboard Copulas

There are other nonparametric estimators of the copula function that are true copulas. Of interest to our work is the Checkerboard construction (see [ DocumenterCitations.CitationSiteNode("cuberos2019-cite-1")

, DocumenterCitations.CitationSiteNode("mikusinski2010-cite-1")

]), detailed below.

First, for any mNd, let {Bi,m,i<m} be a partition of the unit hypercube defined by

Bi,m=]im,i+1m].

Furthermore, for any copula C (or more generally distribution function F), we denote μC (resp μF) the associated measure. For example, for the independence copula Pi, μΠ(A)=λ(A[0,1]) where λ is the Lebesgue measure.

Definition: Empirical Checkerboard copulas

Let mNd. The m-Checkerboard copula C^N,m, defined by

C^N,m(x)=m1i<mμC^N(Bi,m)μΠ(Bi,m[0,x]),

is a genuine copula as soon as m1,...,md all divide N.

Property: Consistency of C^N,m

If all m1,...,md divide N,

supu[0,1]d|C^N,m(u)C(u)|d2m+OP(n1/2).

This copula is called Checkerboard, as it fills the unit hypercube with hyperrectangles of same shapes Bi,m, conditionally on which the distribution is uniform, and the mixing weights are the empirical frequencies of the hyperrectangles.

It can be noted that there is no need for the hyperrectangles to be filled with a uniform distribution (μΠ), as soon as they are filled with copula measures and weighted according to the empirical measure in them (or to any other copula). The direct extension is then the more general patchwork copulas, whose construction is detailed below.

Denoting Bi,m(x)=Bi,m[0,x], we have :

mdμΠ(Bi,m[0,x])=μΠ(Bi,m[0,x])μΠ(Bi,m)=μΠ(Bi,m(x))μΠ(Bi,m)=μΠ(mBi,m(x))

where we intend m]a,b]=]ma,mb] (products between vectors are componentwise).

This allows for an easy generalization in the framework of patchwork copulas [ DocumenterCitations.CitationSiteNode("durante2012-cite-1")

– DocumenterCitations.CitationSiteNode("durante2015-cite-1")

]:

Definition: Patchwork copulas

Let mNd all divide N, and let C={Ci,i<m} be a given collection of copulas. The distribution function:

C^N,m,C(x)=i<mμC^N(Bi,m)μCi(mBi,m(x))

is a copula.

In fact, replacing C^N by any copula in the patchwork construct still yields a genuine copula, with no more conditions that all components of m divide N. The Checkerboard grids are practical in the sense that computations associated to a Checkerboard copula can be really fast: if the grid is large, the number of boxes is small, and otherwise if the grid is very refined, many boxes are probably empty. On the other hand, the grid is fixed a priori, see [ DocumenterCitations.CitationSiteNode("laverny2020-cite-1")

] for a construction with an adaptive grid.

Convergence results for this kind of copulas can be found in [ DocumenterCitations.CitationSiteNode("durante2015-cite-2")

], with a slightly different parametrization.

In the package, this copula is implemented as CheckerboardCopula:

See the canonical Public API entry for CheckerboardCopula.

Conditionals and distortions

  • Conditioning on one coordinate uses the corresponding histogram slice.

  • Conditioning on several coordinates preserves the checkerboard semantics on the remaining axes and renormalizes the relevant cell probabilities.

Performance notes

  • Construction cost scales with sample size but stores only occupied boxes (sparse). CDF evaluation is O(#occupied boxes) at query time.

  • For large n choose coarser m to reduce occupied boxes; for small n a finer grid is possible but may leave many empty boxes.

Empirical Extreme-Value copula

In addition to the empirical, beta, Bernstein and checkerboard constructions, Copulas.jl provides a nonparametric extreme-value estimator through EmpiricalEVCopula. It accepts a sample in the usual d×n layout and returns an ExtremeValueCopula whose tail is estimated from the pseudo-observations.

The same public constructor selects a dimension-appropriate representation:

  • in d=2, EmpiricalEVTail estimates the scalar Pickands function using the Pickands, CFG, or OLS-intercept estimator;

  • in d3, EmpiricalEVMultivariateTail builds a multivariate Pickands pilot and projects it onto a finite discrete spectral measure. The projection enforces a valid stable tail dependence function and provides an exact spectral sampler for the fitted model.

Here is a complete multivariate workflow:

julia
using Copulas, Distributions, Random

rng = Xoshiro(42)
Ctrue = LogCopula{3}(2.0)
U = rand(rng, Ctrue, 150)

Chat = EmpiricalEVCopula{3}(U; method=:ols, degree=3)
(cdf(Chat, [0.4, 0.6, 0.8]), size(rand(rng, Chat, 100)))
(0.3346478302140466, (3, 100))

The runtime-dimension and inferred-dimension forms are equivalent:

julia
Chat_runtime = EmpiricalEVCopula(3, U; method=:ols, degree=3)
Chat_inferred = EmpiricalEVCopula(U; method=:ols, degree=3)

The estimator is also available through the common fitting interface:

julia
Chat_fit = fit(Copulas.ExtremeValueCopula, U; method=:ols, degree=3)

The projected multivariate model may contain singular components. Therefore cdf and rand are supported, but a global Lebesgue pdf is deliberately not defined. See Extreme Value copulas for the STDF theory, the projection references, and the complete list of EV families.

See the canonical Public API entries for EmpiricalEVTail, EmpiricalEVMultivariateTail.

Empirical Archimedean generator (Kendall inversion)

Beyond copula estimators, we also provide a nonparametric estimator of a d-Archimedean generator from data, based on the empirical Kendall distribution following [ DocumenterCitations.CitationSiteNode("genest2011a-cite-1")

]. For a d-Archimedean copula with generator φ, there exists a nonnegative random variable R (the radial law) such that

φ(t)=E[(1t/R)+d1].

Approximating the (unknown) R by a discrete measure R^=jwjδrj yields a piecewise-polynomial generator

φ^(t)=jwj(1t/rj)+d1.

The radii and weights are recovered from the empirical Kendall distribution via a triangular recursion (see the example page for details), and the resulting generator is exposed as EmpiricalGenerator.

Usage:

  • Build from d×n pseudo-observations: Ĝ = EmpiricalGenerator(u; pseudo_values=true). For raw data, use pseudo_values=false.

  • Use directly in an Archimedean copula: Ĉ = ArchimedeanCopula(d, Ĝ)

  • Access the fitted radial law: R̂ = 𝒲₋₁(Ĝ, d)

See the canonical Public API entry for EmpiricalGenerator.

Performance notes

  • The Kendall sample computation is currently O(n^2) in the number of observations. For large n, future versions may switch to Fenwick-tree–based sweeps to reach ~O(n log n) in bivariate cases and ~O(n log^{d-1} n) for higher d.

See This example page for more details and example usages.

Available models

EmpiricalCopula

For observations U1,,Un, the empirical CDF is Cn(u)=n1i1{Uiu}. Construct it from a d×n matrix with EmpiricalCopula(U; pseudo_values=true), EmpiricalCopula{d}(U; ...), or EmpiricalCopula(d, U; ...); use pseudo_values=false for raw observations.

BernsteinCopula

The Bernstein copula applies the multivariate Bernstein polynomial displayed above to a base copula or empirical sample. The integer or tuple m gives the polynomial degrees. Use BernsteinCopula(C; m=10), BernsteinCopula(U; m=10), or the corresponding {d} / (d, ...) forms.

CheckerboardCopula

The checkerboard copula assigns empirical probability wk to each regular grid cell and is uniform within that cell. Thus its density there is wkjmj and its CDF is the multilinear cell-overlap interpolation. Use CheckerboardCopula(U; m=nothing, pseudo_values=true) or the corresponding {d} / (d, ...) forms. Every mj must divide the sample size.

BetaCopula

The empirical beta copula replaces each rank indicator by the CDF of a Beta(Rij,n+1Rij) variable, as defined above. Build it from a d×n data matrix with BetaCopula(U), BetaCopula{d}(U), or BetaCopula(d, U).

EmpiricalEVCopula

This estimator projects an empirical extreme-value estimate onto a valid Pickands function in dimension two or a valid spectral/STDF model in higher dimension. Use EmpiricalEVCopula(U; method=:ols), EmpiricalEVCopula{d}(U; method=:ols), or EmpiricalEVCopula(d, U; method=:ols); degree controls the multivariate projection basis.

See the canonical Public API for all estimator options and validation.

References

  1. C. Genest, J. Nešlehová and J. Ziegel. Inference in Multivariate Archimedean Copula Models. TEST 20, 223–256 (2011).

  2. P. Deheuvels. La Fonction de Dépendance Empirique et Ses Propriétés. Académie Royale de Belgique. Bulletin de la Classe des Sciences 65, 274–292 (1979).

  3. J. Segers, M. Sibuya and H. Tsukahara. The Empirical Beta Copula. Journal of Multivariate Analysis 155, 35–51 (2017).

  4. A. Cuberos, E. Masiello and V. Maume-Deschamps. Copulas Checker-Type Approximations: Application to Quantiles Estimation of Sums of Dependent Random Variables. Communications in Statistics - Theory and Methods 49, 3044–3062 (2020).

  5. P. Mikusiński and M. D. Taylor. Some Approximations of N-Copulas. Metrika 72, 385–414 (2010).

  6. F. Durante, E. Foscolo, J. A. Rodríguez-Lallena and M. Úbeda-Flores. A Method for Constructing Higher-Dimensional Copulas. Statistics 46, 387–404 (2012).

  7. F. Durante, J. Fernández Sánchez and C. Sempi. Multivariate Patchwork Copulas: A Unified Approach with Applications to Partial Comonotonicity. Insurance: Mathematics and Economics 53, 897–905 (2013).

  8. F. Durante, J. Fernández-Sánchez, J. J. Quesada-Molina and M. Úbeda-Flores. Convergence Results for Patchwork Copulas. European Journal of Operational Research 247, 525–531 (2015).

  9. O. Laverny. Empirical and Non-Parametric Copula Models with the Cort R Package. Journal of Open Source Software 5, 2653 (2020).