Hypothesis testing
Copula models make qualitative claims about dependence: coordinates may be independent or exchangeable, a dependence structure may be radially symmetric or max-stable, and a chosen parametric family may or may not describe the data. Hypothesis tests turn each claim into a discrepancy that can be compared with the fluctuations expected under a null model.
This page develops tests of:
mutual independence;
exchangeability;
radial symmetry;
extreme-value dependence (max-stability);
goodness of fit for a specified copula;
goodness of fit for a fitted copula family.
The common pattern is simple: define a property of the unknown copula, measure its violation with the empirical copula, then calibrate that discrepancy by a simulation, randomization, multiplier method or parametric bootstrap. The procedures draw on [ DocumenterCitations.CitationSiteNode("genest2004independence-cite-1")
], [ DocumenterCitations.CitationSiteNode("fermanian2004empirical-cite-1")
], [ DocumenterCitations.CitationSiteNode("remillard2009equality-cite-1")
], [ DocumenterCitations.CitationSiteNode("bucher2010bootstrap-cite-1")
], and [ DocumenterCitations.CitationSiteNode("genest2009gof-cite-1")
].
From observations to an empirical copula
As elsewhere in Copulas.jl, observations are represented by a d\times n matrix
where each column
is one d-dimensional observation.
The implemented tests are rank based. When
pseudo_values=falsethe input matrix is transformed internally with pseudos. If the data already consist of pseudo-observations in [0,1]^d, use
pseudo_values=trueto avoid ranking them again.
Continuous margins and ties
The currently implemented copula hypothesis tests assume continuous margins and therefore require tie-free observations in every margin. Tied or discrete data are rejected with an ArgumentError.
This is intentional: choosing a rank convention would otherwise produce apparently valid p-values without the tie-aware empirical-process or bootstrap theory required for such data. Although pseudos uses average ranks by default, that convention alone does not make continuous-margin tests valid for discrete or rounded data. Tie-aware procedures are outside the scope of the current implementation.
Given pseudo-observations
where the inequality is understood componentwise.
Empirical-copula processes and their weak convergence form the theoretical basis for many of the statistics and multiplier approximations used below [ DocumenterCitations.CitationSiteNode("fermanian2004empirical-cite-2")
].
Reading a test result
All tests return a CopulaTest, which implements StatsAPI.HypothesisTest.
For example,
using Copulas, Distributions, Random, StatsBase
U = rand(Xoshiro(123), ClaytonCopula(2, 3.0), 80)
test = IndependenceCopulaTest(U; N=49, rng=Xoshiro(123),)The common result interface is
teststatistic(test)0.9991637019373673pvalue(test)0.01nobs(test)80The statistic measures disagreement with the null; the p-value calibrates how unusual that disagreement is under the selected resampling scheme. It is not the probability that the null hypothesis is true. The public result interface consists of these accessors and the printed summary; internal fields are not an extension API.
Printing the object gives a summary of the hypothesis, statistic, calibration, p-value, and relevant test-specific information.
testCopula independence test
------------------------
Number of observations: 80
Dimension: 2
Statistic: cvm
Observed value: 0.9991637019373673
Number of resamples: 49
Calibration: simulation
p-value: 0.01
Null hypothesis:
The components are mutually independent.::: note Number of resamples
The small values of N used in the documentation keep the examples fast. For statistical work, substantially larger values should generally be used, depending on the desired Monte Carlo precision.
:::
Mutual independence
Definition
Let C denote the copula of the random vector. Mutual independence is equivalent to the product copula
Thus
Rank-based independence tests constructed from the empirical copula process are studied in [ DocumenterCitations.CitationSiteNode("genest2004independence-cite-2")
].
Measuring departure from independence
The statistic currently available in Copulas.jl is :cvm. The implementation evaluates the squared discrepancy between the empirical copula and the product copula at the observed pseudo-observations:
Large values indicate departure from mutual independence, but their scale depends on the sample size and dimension; the statistic should therefore be read through its calibrated p-value rather than against a fixed threshold.
Why simulation provides the reference distribution
Under H_0, the coordinates are independent uniforms. The default calibration is therefore :simulation:
generate
nobservations from thed-dimensional product copula;transform the generated sample to pseudo-observations;
recompute
S_n^{\mathrm{ind}};repeat the procedure
Ntimes;compare the observed statistic with its simulated null distribution.
Example
Uind = rand(Xoshiro(1), IndependentCopula(3), 100)
tind = IndependenceCopulaTest(Uind; N=49, rng=Xoshiro(2),)
(teststatistic(tind), pvalue(tind))(0.020861955351027354, 0.91)Exchangeability
Definition
A copula C is exchangeable when it is invariant under permutations of its coordinates.
For a permutation
write
Full exchangeability means
for every \boldsymbol u\in[0,1]^d and every coordinate permutation \pi.
Empirical-copula tests for bivariate symmetry were developed in [ DocumenterCitations.CitationSiteNode("genest2012symmetry-cite-1")
] and extended to arbitrary dimension by [ DocumenterCitations.CitationSiteNode("harder2017exchangeability-cite-1")
].
Measuring sensitivity to coordinate labels
For a collection \mathcal G of non-identity permutations, the implemented statistic is
The default weight is weight=:wm2.
Let
and
For a transposition exchanging coordinates a and b, define
For a general permutation, let
denote the ordered coordinates and define the implementation's permutation separation term by
The :wm2 weight is then
Alternatively,
weight=:nonesets w_\pi(\boldsymbol u)=1.
Which permutations are compared?
The keyword permutations controls the set \mathcal G.
permutations=:G2
This is the default.
For d=2, it contains the only nontrivial transposition,
For d>2, it uses the transposition
together with the cyclic left shift
permutations=:G1
Uses the transpositions
An explicit permutation or collection may also be supplied. Duplicate permutations are removed. Collections are normalized once and stored as vectors.
Permutation sets and memory
The factorial choice permutations=:all is deliberately unsupported. The multiplier procedure retains one dense n × n matrix per permutation; a shared guard rejects matrix payloads above 512 MiB, before auxiliary storage.
Why multiplier calibration is needed
The default calibration is :multiplier.
The empirical-copula process has a nontrivial correction caused by replacing the unknown margins with ranks. The implementation therefore constructs the corresponding multiplier representation, including finite-difference estimates of the partial derivatives of
The derivative bandwidth is
For coordinate
Independent exponential multipliers are generated and centered before applying the empirical-process representation. This type of multiplier approximation is closely related to the methods discussed in [ DocumenterCitations.CitationSiteNode("remillard2009equality-cite-2")
], [ DocumenterCitations.CitationSiteNode("bucher2010bootstrap-cite-2")
], and [ DocumenterCitations.CitationSiteNode("harder2017exchangeability-cite-2")
].
Example
Uex = rand(Xoshiro(4), GumbelCopula(3, 2.0), 80)
tex = ExchangeabilityCopulaTest(Uex; permutations=:G2, weight=:wm2, N=49, rng=Xoshiro(5),)
(teststatistic(tex), pvalue(tex))(0.002308575293400397, 0.6326530612244898)Radial symmetry
Definition
A copula is radially symmetric when
Equivalently, if
Nonparametric tests of copula symmetry and randomization procedures based on the corresponding invariance group are studied in [ DocumenterCitations.CitationSiteNode("beare2020symmetry-cite-1")
].
Comparing a sample with its reflection
Let
The implemented statistic is
Large values indicate radial asymmetry.
Why reflection gives a null experiment
Under radial symmetry, an observation and its radial reflection are distributionally equivalent. For every observation
and construct
The randomized sample is converted back to pseudo-observations before the statistic is evaluated. Because radial reflection of rank-grid values can create exact ties even when the original sample is tie-free, ties induced by the randomization itself are reranked using average ranks. This does not relax the requirement that the original input margins be tie-free.
Thus the default reflection probability is exactly
The procedure exploits the group invariance associated with radial symmetry, following the randomization-testing principle developed in [ DocumenterCitations.CitationSiteNode("beare2020symmetry-cite-2")
].
Example
Urad = rand(Xoshiro(6), GaussianCopula([1.0 0.6; 0.6 1.0]), 80)
trad = RadialSymmetryCopulaTest(Urad; N=49, rng=Xoshiro(7),)
(teststatistic(trad), pvalue(trad))(0.045937500000000006, 0.37)Extreme-value dependence
The defining property
Extreme-value copulas are characterized by max-stability. For any
Equivalently, for
where
This characterization provides a direct way to test
Large-sample tests based on this max-stability identity, the empirical copula, and multiplier approximations are developed by [ DocumenterCitations.CitationSiteNode("kojadinovic2011extremevalue-cite-1")
].
Measuring violations of max-stability
For a finite collection of powers
the implemented statistic is
The default powers are
They can be changed through the powers keyword.
Multiplier calibration
Approximate p-values are obtained from a multiplier representation of the empirical-copula process, following the max-stability testing strategy in [ DocumenterCitations.CitationSiteNode("kojadinovic2011extremevalue-cite-2")
].
As in the exchangeability test, the finite-difference bandwidth used for the empirical partial derivatives is
The multiplier variables are exponential and centered before the bootstrap process is evaluated.
Example
Uev = rand(Xoshiro(8), GumbelCopula(2, 2.5), 80)
tev = ExtremeValueCopulaTest(Uev; powers=3:5, N=49, rng=Xoshiro(9),)
(teststatistic(tev), pvalue(tev))(0.24446130936254915, 0.17)A single power is also allowed:
ExtremeValueCopulaTest(U; powers=2)All supplied powers must be finite and strictly larger than one.
Goodness of fit
Copula goodness-of-fit procedures compare the empirical dependence structure with a proposed parametric copula model. Empirical-process and Cramér–von Mises procedures of this form are reviewed extensively in [ DocumenterCitations.CitationSiteNode("genest2009gof-cite-2")
].
Copulas.jl distinguishes a simple null hypothesis, in which every parameter is fixed before seeing the data, from a composite null hypothesis, in which parameters are estimated. That distinction changes what the bootstrap must reproduce.
A fully specified copula
Suppose that a fully specified copula C_0 is given, including all its parameters.
The null hypothesis is
The implemented Cramér–von Mises-type statistic is
Use
C0 = ClaytonCopula(2, 3.0)
Ugof = rand(Xoshiro(10), C0, 80)
tsimple = GOFCopulaTest(C0, Ugof; N=49, rng=Xoshiro(11),)
pvalue(tsimple)0.21This tests the fully specified copula.
Parametric bootstrap
For every bootstrap replicate:
generate
nobservations fromC_0;transform the sample to pseudo-observations;
compute the same goodness-of-fit statistic;
compare the bootstrap statistic with the observed value.
No parameters are re-estimated because C_0 is fully specified.
A fitted copula family
Suppose instead that
is a parametric copula family and that
The null hypothesis becomes
and the observed statistic is
Because
]; practical copula GOF procedures and their finite sample behavior are discussed in [ DocumenterCitations.CitationSiteNode("genest2009gof-cite-3")
].
In Copulas.jl, every composite bootstrap replicate performs the following steps:
then refits using the same estimator specification,
and computes
Thus parameter estimation is repeated inside every bootstrap replicate rather than treating the fitted parameters as fixed.
The fitting procedure itself is also reproduced. In particular, estimator-defining runtime information such as the fitting method, method-specific keywords, and copula structure is retained whenever the fitted model records a reproducible fitting specification. This matters for models whose fitting procedure cannot be reconstructed from the fitted copula type alone.
Example
First fit a model:
M = fit(CopulaModel, ClaytonCopula, Ugof; method=:itau)Then run the test directly from the fitted model:
tcomposite = GOFCopulaTest(M; N=49, rng=Xoshiro(12),)
pvalue(tcomposite)0.01GOFCopulaTest(M) tests the data used to fit M. The stored fitting input is preprocessed consistently with the original fit before the observed statistic is computed. The fitted model M supplies both the estimated null model and the estimator specification that is replayed in every bootstrap replicate.
A separate sample can be tested with
GOFCopulaTest(M, U)In this form, M is interpreted as an estimator specification, not as a fixed set of parameter estimates. The same fitting procedure is first reapplied to U, so the observed statistic uses parameters estimated from the sample being tested. Each parametric-bootstrap replicate then repeats that same fitting procedure.
Consequently, the observed statistic and every bootstrap statistic are based on the same estimation rule. If the original fitting procedure cannot be reproduced safely, composite goodness-of-fit testing raises an ArgumentError rather than silently replacing it by a different estimator.
Interpreting resampling p-values
Simulation, randomization and parametric bootstrap use (0.5 + count(Tstar >= Tobserved)) / (N + 1). The EV multiplier test uses the same convention; the exchangeability multiplier test uses the uncorrected strict proportion count(Tstar > Tobserved) / N. These are resampling approximations, not exact finite-sample level guarantees. Increasing N reduces Monte Carlo noise but does not repair an inappropriate null hypothesis, dependent observations or violated regularity assumptions.
Scope and reference variants
Observations must be independent and identically distributed. Continuous, tie-free margins alone do not establish the regularity assumptions required by empirical-copula multiplier theory; consult the cited procedures before applying them to singular models.
The radial randomization implemented here reranks using average ranks. It is a variant of the bivariate procedure of [ DocumenterCitations.CitationSiteNode("beare2020symmetry-cite-3")
], which additionally breaks induced ties with a small random perturbation. The multidimensional version implemented here extends the reflection and reranking operations; the cited bivariate theorem does not by itself establish its validity in higher dimensions.
The EV statistic uses the empirical copula directly, without the finite-sample offset used by some implementations. Its multiplier approximation and default powers 3:5 follow [ DocumenterCitations.CitationSiteNode("kojadinovic2011extremevalue-cite-3")
]. Do not expect identical finite-sample p-values from implementations with different corrections.