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.
If
where
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:
The empirical distribution function of the normalized ranks,
is called the empirical copula function.
is an exhaustive estimator of
then converges (weakly) to
The empirical copula is not a true copula
Despite its name, 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
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:
Denoting
is a genuine copula, called the Beta copula.
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
It is a multivariate Bernstein polynomial approximation of
]. 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
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
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
Furthermore, for any copula
Let
is a genuine copula as soon as
If all
This copula is called Checkerboard, as it fills the unit hypercube with hyperrectangles of same shapes
It can be noted that there is no need for the hyperrectangles to be filled with a uniform distribution (
Denoting
where we intend
This allows for an easy generalization in the framework of patchwork copulas [ DocumenterCitations.CitationSiteNode("durante2012-cite-1")
– DocumenterCitations.CitationSiteNode("durante2015-cite-1")
]:
Let
is a copula.
In fact, replacing
] 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 ExtremeValueCopula whose tail is estimated from the pseudo-observations.
The same public constructor selects a dimension-appropriate representation:
in
, EmpiricalEVTailestimates the scalar Pickands function using the Pickands, CFG, or OLS-intercept estimator;in
, EmpiricalEVMultivariateTailbuilds 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:
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:
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:
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
]. For a
Approximating the (unknown)
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×npseudo-observations:Ĝ = EmpiricalGenerator(u; pseudo_values=true). For raw data, usepseudo_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 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 CheckerboardCopula(U; m=nothing, pseudo_values=true) or the corresponding {d} / (d, ...) forms. Every
BetaCopula
The empirical beta copula replaces each rank indicator by the CDF of a 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
C. Genest, J. Nešlehová and J. Ziegel. Inference in Multivariate Archimedean Copula Models. TEST 20, 223–256 (2011).
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).
J. Segers, M. Sibuya and H. Tsukahara. The Empirical Beta Copula. Journal of Multivariate Analysis 155, 35–51 (2017).
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).
P. Mikusiński and M. D. Taylor. Some Approximations of N-Copulas. Metrika 72, 385–414 (2010).
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).
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).
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).
O. Laverny. Empirical and Non-Parametric Copula Models with the Cort R Package. Journal of Open Source Software 5, 2653 (2020).