# Exchangeability Test¶

copulae.gof.exch_test(x, y, N=1000, m=0, ties='average')[source]

Test of Exchangeability for a Bivariate Copula.

Test for assessing the exchangeability of the underlying bivariate copula based on the empirical copula. The test statistics are defined in the first two references. Approximate p-values for the test statistics are obtained by means of a multiplier technique if there are no ties in the component series of the bivariate data, or by means of an appropriate bootstrap otherwise.

A random vector X is called exchangeable iff $$(X1, ..., Xd) = (X_{\pi(1)}, ..., X_{\pi(d)})$$ for any permutation $$(\pi(1), \pi(2), \dots, \pi(d))$$ of $$(1, \dots, d)$$.

A copula C is called exchangeable iff C is the distribution function of an exchangeable random vector (with uniform marginal distributions on [0, 1]). For such a copula $$C(u1, u2, ..., ud ) = C(u\pi(1), u\pi(2), ..., u\pi(d))$$ holds for any permutation $$(\pi(1), \pi(2), \dots, \pi(d))$$ of $$(1, \dots, d)$$.

Examples of exchangeable copulas:

Gumbel, Clayton, and also the Gaussian copula $$C_P^{Ga}$$ and the t-Copula $$C_{ν,P}^t$$, if P is an equicorrelation matrix, i.e. $$R = \rho J_d + (1 − \rho)I_d$$. $$J_d \in R^{d×d}$$ is a matrix consisting only of ones, and $$I_d \in R^{d×d}$$ is the d-dimensional identity matrix.

For bivariate exchangeable copulas we have:

$P(U_2 \leq u_2|U_1 = u_1) = P(U_1 \leq u_2|U_2 = u_1).$
Parameters
• x (array_like) – first vector for the exchangeability test

• y (array_like) – second vector for the exchangeability test

• N (int) – Number of multiplier or bootstrap iterations to be used to simulate realizations of the test statistic under the null hypothesis.

• m (int) – If m = 0, integration in the Cramér–von Mises statistic is carried out with respect to the empirical copula. If m > 0, integration is carried out with respect to the Lebesgue measure and m specifies the size of the integration grid.

• ties (str, optional) – String specifying how ranks should be computed if there are ties in any of the coordinate samples. Options include ‘average’, ‘min’, ‘max’, ‘dense’, ‘ordinal’.

Returns

Test statistics for the exchangeability test. The null hypothesis assumes that the vectors are exchangeable. Thus a small p-value will indicate evidence against exchangeability

Return type

TestStatistic

Examples

>>> from copulae.datasets import load_danube
>>> from copulae.gof import exch_test