Skip to content

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

U=(U11U1nUd1Udn),

where each column

Ui=(U1i,,Udi)

is one d-dimensional observation.

The implemented tests are rank based. When

julia
pseudo_values=false

the input matrix is transformed internally with pseudos. If the data already consist of pseudo-observations in [0,1]^d, use

julia
pseudo_values=true

to 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.

Definition: Empirical copula

Given pseudo-observations U1,,Un, the empirical copula is

Cn(u)=1ni=1n1(Uiu),

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,

julia
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

julia
teststatistic(test)
0.9991637019373673
julia
pvalue(test)
0.01
julia
nobs(test)
80

The 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.

julia
test
Copula 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

Definition: Mutual independence

Let C denote the copula of the random vector. Mutual independence is equivalent to the product copula

Π(u)=j=1duj.

Thus

H0:C(u)=Π(u)for every u[0,1]d.

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:

Snind=i=1n[Cn(Ui)j=1dUji]2.

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:

  1. generate n observations from the d-dimensional product copula;

  2. transform the generated sample to pseudo-observations;

  3. recompute S_n^{\mathrm{ind}};

  4. repeat the procedure N times;

  5. compare the observed statistic with its simulated null distribution.

Example

julia
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

Definition: Exchangeability

A copula C is exchangeable when it is invariant under permutations of its coordinates.

For a permutation

π:{1,,d}{1,,d},

write

uπ=(uπ(1),,uπ(d)).

Full exchangeability means

H0:C(u)=C(uπ)

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

Snex=πGi=1n[Cn(Ui)Cn(Ui,π)]2wπ(Ui).

The default weight is weight=:wm2.

Let

m(u)=min1jduj,

and

b(u)=d1+m(u)j=1duj.

For a transposition exchanging coordinates a and b, define

ωπ(u)=|uaub|.

For a general permutation, let

u(1)u(d)

denote the ordered coordinates and define the implementation's permutation separation term by

ωπ(u)=k=d/2+1d(u(k)m(u)).

The :wm2 weight is then

wπ(u)=[max{0,min(m(u),ωπ(u),b(u))}]2.

Alternatively,

julia
weight=:none

sets 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,

(12).

For d>2, it uses the transposition

(12)

together with the cyclic left shift

(12d).

permutations=:G1

Uses the transpositions

(12),(13),,(1d).

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 Cn.

The derivative bandwidth is

hn=n1/2.

For coordinate j, the derivative is approximated by a boundary-corrected finite difference of the form

C˙n,j(u)Cn(u+hnej)Cn(uhnej)effective width.

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

julia
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

Definition: Radial symmetry

A copula is radially symmetric when

U=d1U.

Equivalently, if Crad denotes the copula of 1U, then

H0:C=Crad.

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 Cn denote the empirical copula of the original pseudo-observations and let Cn¯ denote the empirical copula constructed from

1U1,,1Un.

The implemented statistic is

Snrad=i=1n[Cn(Ui)C¯n(Ui)]2.

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 i, independently generate

BiBernoulli(1/2),

and construct

Ui={Ui,Bi=0,1Ui,Bi=1.

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

Pr(Bi=1)=12.

The procedure exploits the group invariance associated with radial symmetry, following the randomization-testing principle developed in [ DocumenterCitations.CitationSiteNode("beare2020symmetry-cite-2")

].

Example

julia
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

Property: Max-stability

Extreme-value copulas are characterized by max-stability. For any r>0,

C(u1r,,udr)=C(u1,,ud)r.

Equivalently, for r>1,

C(u)=C(u1/r)r,

where

u1/r=(u11/r,,ud1/r).

This characterization provides a direct way to test

H0:C belongs to the extreme-value class.

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

R={r1,,rK},rk>1,

the implemented statistic is

SnEV=rRi=1n[Cn(Ui1/r)rCn(Ui)]2.

The default powers are

R={3,4,5}.

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

hn=n1/2.

The multiplier variables are exponential and centered before the bootstrap process is evaluated.

Example

julia
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:

julia
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

Definition: Simple null hypothesis

Suppose that a fully specified copula C_0 is given, including all its parameters.

The null hypothesis is

H0:C=C0.

The implemented Cramér–von Mises-type statistic is

SnGOF=i=1n[Cn(Ui)C0(Ui)]2.

Use

julia
C0 = ClaytonCopula(2, 3.0)
Ugof = rand(Xoshiro(10), C0, 80)

tsimple = GOFCopulaTest(C0, Ugof; N=49, rng=Xoshiro(11),)

pvalue(tsimple)
0.21

This tests the fully specified copula.

Parametric bootstrap

For every bootstrap replicate:

  1. generate n observations from C_0;

  2. transform the sample to pseudo-observations;

  3. compute the same goodness-of-fit statistic;

  4. compare the bootstrap statistic with the observed value.

No parameters are re-estimated because C_0 is fully specified.

A fitted copula family

Definition: Composite null hypothesis

Suppose instead that

C={Cθ:θΘ}

is a parametric copula family and that θ^ is estimated from the data.

The null hypothesis becomes

H0:CC,

and the observed statistic is

SnGOF=i=1n[Cn(Ui)Cθ^(Ui)]2.

Because θ^ is estimated, the uncertainty introduced by fitting must also be reproduced in the bootstrap. Parametric-bootstrap validity for this type of semiparametric goodness-of-fit problem is studied in [ DocumenterCitations.CitationSiteNode("genest2008bootstrap-cite-1")

]; 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:

U1,,UnCθ^,

then refits using the same estimator specification,

θ^=fit(U1,,Un),

and computes

Sn=i=1n[Cn(Ui)Cθ^(Ui)]2.

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:

julia
M = fit(CopulaModel, ClaytonCopula, Ugof; method=:itau)

Then run the test directly from the fitted model:

julia
tcomposite = GOFCopulaTest(M; N=49, rng=Xoshiro(12),)

pvalue(tcomposite)
0.01

GOFCopulaTest(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

julia
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.