copul.family.extreme_value package
Submodules
copul.family.extreme_value.bb5 module
- class copul.family.extreme_value.bb5.BB5(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- cdf(u=None, v=None, **kwargs)[source]
Evaluate the CDF numerically via cdf_vectorized.
The symbolic CDF of the BB5 copula contains deeply nested logarithms and powers that are prohibitively slow to evaluate through SymPy’s
evalf. This override routes all concrete (u, v) evaluations to the fast numpy path.
- delta = delta
- dim: int
- intervals: dict = {'delta': Interval.open(0, oo), 'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [theta, delta]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
- theta = theta
copul.family.extreme_value.biv_extreme_value_copula module
- class copul.family.extreme_value.biv_extreme_value_copula.BivExtremeValueCopula(*args, **kwargs)[source]
Bases:
MultivariateExtremeValueCopula,BivCoreCopulaBivariate extreme value copula.
Specialization of
MultivariateExtremeValueCopulato the 2-dimensional case. Provides additional methods specific to bivariate extreme value theory using Pickands dependence functions.- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for extreme value copulas.
Since \(C(\tfrac12,\tfrac12) = (\tfrac14)^{A(1/2)}\):
\[\beta = 4 \cdot (1/4)^{A(1/2)} - 1\]- Return type:
float
- property cdf
Cumulative distribution function of the copula.
- Returns:
Wrapper around the symbolic CDF expression.
- Return type:
- cdf_vectorized(u, v)[source]
Vectorized cumulative distribution function.
- Parameters:
u (array_like) – Uniform marginals in [0,1].
v (array_like) – Uniform marginals in [0,1].
- Returns:
Values of \(C(u,v)\).
- Return type:
numpy.ndarray
Notes
Implements
\[C(u,v) = (uv)^{A(\log v / \log(uv))}.\]
- cond_distr_1(u=None, v=None)[source]
First conditional distribution \(\partial C/\partial u\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial u\).
- Return type:
float
- cond_distr_2(u=None, v=None)[source]
Second conditional distribution \(\partial C/\partial v\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial v\).
- Return type:
float
- deriv_pickand_at_0()[source]
Derivative of the Pickands function at \(t=0\).
- Returns:
Value of \(A'(0)\).
- Return type:
float or sympy.Expr
- classmethod from_pickands(pickands, params=None)[source]
Construct a new copula from a Pickands dependence function.
- Parameters:
pickands (str or sympy.Expr) – Pickands dependence function. May contain
tor another symbol.params (list[str|sympy.Symbol] | str | None) – Parameter names/symbols. If
None, symbols are detected automatically.
- Returns:
Instance with the specified Pickands function.
- Return type:
- gini_gamma(*args, **kwargs)[source]
Gini’s \(\gamma\) for extreme value copulas.
\[\gamma = 4\!\left[ \int_0^1 t^{A(1/2)}\,dt + \int_0^1 \bigl(t(1-t)\bigr)^{A\!\left(\frac{\ln(1-t)} {\ln(t(1-t))}\right)}\,dt \right] - 2\]Computed numerically via the vectorized CDF.
- Return type:
float
- intervals: dict = {}
- property is_ci
Whether the copula is conditionally increasing.
- Returns:
Always
Truefor extreme value copulas.- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Spearman’s \(\rho\).
- Returns:
Symbolic expression of Spearman’s \(\rho\).
- Return type:
sympy.Expr
- lambda_L()[source]
Lower tail dependence coefficient for extreme value copulas.
All bivariate extreme value copulas have \(\lambda_L = 0\).
- Returns:
Always 0.
- Return type:
float
- lambda_U()[source]
Upper tail dependence coefficient for extreme value copulas.
\[\lambda_U = 2\bigl(1 - A(\tfrac12)\bigr)\]where \(A\) is the Pickands dependence function.
- Return type:
float
References
Gudendorf & Segers (2010), Extreme-Value Copulas.
- params: list = []
- property pdf
Probability density function of the copula.
- Returns:
Wrapper around the symbolic or numerical PDF.
- Return type:
- property pickands
Return the Pickands dependence function with parameter values substituted.
- Returns:
A wrapper that supports evaluation at \(t\) values and symbolic use.
- Return type:
- plot_pickands(subs=None, **kwargs)[source]
Plot the Pickands dependence function.
- Parameters:
subs (dict, optional) – Parameter substitutions.
**kwargs – Additional substitutions.
- spearmans_rho(*args, **kwargs)[source]
Spearman’s \(\rho\) for the extreme value copula.
- Parameters:
*args – Copula parameters.
**kwargs – Copula parameters.
- Returns:
Symbolic expression of Spearman’s \(\rho\).
- Return type:
sympy.Expr
- t = t
- tail_dependence_function(t, lower=True)[source]
Evaluate the tail dependence function at \(t \in [0,1]\).
For bivariate extreme value copulas the upper TDF has the closed form
\[b_U(t) = 1 - A(t)\]The lower TDF is identically 0 (since \(\lambda_L = 0\)).
- Parameters:
t (float or array_like) – Point(s) in \([0,1]\).
lower (bool) – If
True, return the lower TDF (always 0). IfFalse, return the upper TDF.
- Return type:
float or numpy.ndarray
- tail_order()[source]
Tail order \(\kappa\) for extreme value copulas.
For any bivariate extreme value copula the lower tail order is \(\kappa_L = 1 / A(1/2)\) and the upper tail order is 1 whenever \(\lambda_U > 0\), or the rate at which \(A(t) \to 1\) near the endpoints.
- Returns:
{"lower": kappa_L, "upper": kappa_U}- Return type:
dict
- u = u
- v = v
- copul.family.extreme_value.biv_extreme_value_copula.from_pickands(pickands, params=None)[source]
Construct a bivariate extreme value copula from a Pickands function.
- Parameters:
pickands (str or sympy.Expr) – Pickands dependence function. May contain
tor another symbol.params (list or str, optional) – Parameter names. If
None, symbols are detected automatically.
- Returns:
Instance with the specified Pickands function.
- Return type:
copul.family.extreme_value.cuadras_auge module
- class copul.family.extreme_value.cuadras_auge.CuadrasAuge(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaCuadras-Auge copula, special case of the Marshall-Olkin copula.
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Cuadras-Augé copula.
\[\beta = 4\,C(\tfrac12,\tfrac12) - 1 = 4\cdot 2^{-\delta}\cdot 2^{-(2-2\delta)} - 1 = 2^{2-\delta} \cdot 2^{-2+2\delta}\cdot 4 - 1 \;=\; 2^{\delta} - 1\]
- chatterjees_xi(*args, **kwargs)[source]
Compute Chatterjee’s xi correlation measure.
This method sets the parameters, computes intermediate integrals, and returns the simplified expression for xi.
- Returns:
A wrapper around the symbolic expression for Chatterjee’s xi.
- Return type:
- cond_distr_1(u=None, v=None)[source]
First conditional distribution \(\partial C/\partial u\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial u\).
- Return type:
float
- delta = delta
- dim: int
- gini_gamma(*args, **kwargs)[source]
Gini’s \(\gamma\) for the Cuadras-Augé copula.
\[\gamma = 4\!\left[\int_0^1 C(t,t)\,dt + \int_0^1 C(t,1{-}t)\,dt\right] - 2\]For the CA copula, \(C(t,t) = t^{2-\delta}\) (since \(\min(t,t)=t\)), so the diagonal integral is \(1/(3-\delta)\). The anti-diagonal \(C(t,1-t)\) requires splitting at \(t=1/2\).
- hoeffdings_d(*args, **kwargs)[source]
Hoeffding’s \(D\) for the Cuadras-Augé copula.
Expanding the double integral \(90\iint(C-uv)^2\,du\,dv\) over the two regions \(\{v \le u\}\) and \(\{u < v\}\) (using symmetry) gives:
\[D(\delta) = \frac{10\,\delta^{2}} {18 - 9\,\delta + \delta^{2}}\]which satisfies \(D(0)=0\) and \(D(1)=1\).
- intervals: dict = {'delta': Interval(0, 1)}
- property is_absolutely_continuous
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Spearman’s \(\rho\).
- Returns:
Symbolic expression of Spearman’s \(\rho\).
- Return type:
sympy.Expr
- params: list = [delta]
- property pdf
Probability density function of the copula.
- Returns:
Wrapper around the symbolic or numerical PDF.
- Return type:
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Cuadras-Augé copula.
The CA copula is PQD for all \(\delta \in (0,1]\), so \(\sigma = \rho_S = 3\delta/(4-\delta)\).
copul.family.extreme_value.galambos module
- class copul.family.extreme_value.galambos.Galambos(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaGalambos extreme value copula with parameter \(\delta > 0\).
- CDF:
C(u,v) = u v exp( ((-log u)^(-delta) + (-log v)^(-delta))^(-1/delta) )
for (u,v) in (0,1]^2, with the usual boundary extensions.
- delta = delta
- dim: int
- intervals: dict = {'delta': Interval.open(0, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [delta]
- property pdf
Numerical PDF via finite differences on cdf_vectorized.
copul.family.extreme_value.gumbel_hougaard module
- class copul.family.extreme_value.gumbel_hougaard.GumbelHougaardEV(*args, **kwargs)[source]
Bases:
MultivariateGumbelHougaard,BivExtremeValueCopulaBivariate Gumbel-Hougaard Extreme Value Copula.
A specialized version of the multivariate Gumbel-Hougaard copula for the bivariate case. This copula combines features of both the bivariate extreme value copula and the multivariate Gumbel-Hougaard copula.
The CDF is given by: C(u,v) = exp(-(((-ln u)^θ + (-ln v)^θ)^(1/θ)))
Special cases: - θ = 1: Independence copula - θ → ∞: Comonotonicity copula (perfect positive dependence)
- Parameters:
theta (float, optional) – Dependence parameter (default is None). Must be greater than or equal to 1.
- dim: int
- intervals: dict = {'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
The Gumbel-Hougaard copula is absolutely continuous.
- Returns:
True
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
The Gumbel-Hougaard copula is symmetric.
- Returns:
True
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Kendall’s tau for the Gumbel-Hougaard copula.
For the Gumbel-Hougaard copula, Kendall’s tau has the closed form (θ-1)/θ.
- Parameters:
*args – Parameters for the copula.
**kwargs – Parameters for the copula.
- Returns:
Kendall’s tau value or expression.
- Return type:
float or sympy.Expr
- params: list = [theta]
- theta = theta
copul.family.extreme_value.huesler_reiss module
- class copul.family.extreme_value.huesler_reiss.HueslerReiss(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaHüsler–Reiss extreme value copula with parameter \(\delta \ge 0\). When \(\delta=0\), it reduces to the independence copula.
- cdf_vectorized(u, v)[source]
Vectorized implementation of the Hüsler–Reiss copula CDF:
C(u,v) = (u * v)^A(t), where t = ln(v) / ln(u*v), A(t) = (1 - t)*Φ(z(1 - t)) + t*Φ(z(t)), z(x) = 1/delta + (delta/2)*ln(x/(1 - x)).
- delta = delta
- dim: int
- intervals: dict = {'delta': Interval(0, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [delta]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
copul.family.extreme_value.joeev module
- class copul.family.extreme_value.joeev.JoeEV(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- alpha_1 = alpha_1
- alpha_2 = alpha_2
- cdf(u=None, v=None, **kwargs)[source]
Evaluate the CDF numerically via cdf_vectorized.
The symbolic CDF of the JoeEV copula contains deeply nested logarithms and powers that are slow to evaluate through SymPy’s
evalf. This override routes all concrete (u, v) evaluations to the fast numpy path.
- delta = delta
- dim: int
- intervals: dict = {'alpha_1': Interval(0, 1), 'alpha_2': Interval(0, 1), 'delta': Interval.open(0, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [alpha_1, alpha_2, delta]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
copul.family.extreme_value.marshall_olkin module
- class copul.family.extreme_value.marshall_olkin.MarshallOlkin(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- property alpha_1
- property alpha_2
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Marshall-Olkin copula.
\[\beta = 4\,C(\tfrac12,\tfrac12) - 1 = 4 \cdot 2^{-\max(\alpha_1,\alpha_2)} \cdot (\tfrac14)^{1-?} - 1\]Uses the general \(4C(1/2,1/2)-1\) formula directly.
- chatterjees_xi(*args, **kwargs)[source]
Compute Chatterjee’s xi correlation measure.
This method sets the parameters, computes intermediate integrals, and returns the simplified expression for xi.
- Returns:
A wrapper around the symbolic expression for Chatterjee’s xi.
- Return type:
- cond_distr_1(u=None, v=None)[source]
First conditional distribution \(\partial C/\partial u\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial u\).
- Return type:
float
- cond_distr_2(u=None, v=None)[source]
Second conditional distribution \(\partial C/\partial v\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial v\).
- Return type:
float
- dim: int
- intervals: dict = {'alpha_1': Interval(0, 1), 'alpha_2': Interval(0, 1)}
- property is_absolutely_continuous
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Spearman’s \(\rho\).
- Returns:
Symbolic expression of Spearman’s \(\rho\).
- Return type:
sympy.Expr
- params: list = [alpha_1, alpha_2]
- property pdf
Probability density function of the copula.
- Returns:
Wrapper around the symbolic or numerical PDF.
- Return type:
copul.family.extreme_value.multivar_ev_independence_copula module
- class copul.family.extreme_value.multivar_ev_independence_copula.MultivariateExtremeIndependenceCopula(dimension=2, **kwargs)[source]
Bases:
MultivariateExtremeValueCopulaMultivariate Independence Copula as an Extreme Value Copula.
This class represents the independence copula C(u₁, u₂, …, uₙ) = u₁ × u₂ × … × uₙ as a special case of an extreme value copula.
The independence copula is the only copula that is both an extreme value copula and an Archimedean copula. In the extreme value context, it corresponds to having complete tail independence between variables.
- Parameters:
dimension (int, optional) – Dimension of the copula (number of variables). Default is 2.
- property cdf
Compute the cumulative distribution function (CDF) of the independence copula.
For the independence copula, the CDF is the product of all marginals: C(u₁, u₂, …, uₙ) = u₁ × u₂ × … × uₙ
- Returns:
A wrapper around the CDF function.
- Return type:
- cdf_vectorized(*args)[source]
Vectorized implementation of the CDF for the independence copula.
- Parameters:
*args (array_like) – Arrays of dimension values to evaluate the CDF at.
- Returns:
Array of CDF values.
- Return type:
numpy.ndarray
- intervals = {}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
The independence copula is absolutely continuous.
- Returns:
True
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
The independence copula is symmetric in all its arguments.
- Returns:
True
- Return type:
bool
- kendalls_tau()[source]
Compute Kendall’s tau for the independence copula.
For the independence copula, Kendall’s tau is 0 as there is no dependence.
- Returns:
0
- Return type:
float
- lambda_L()[source]
Compute the lower tail dependence coefficient.
For the independence copula, there is no tail dependence.
- Returns:
0
- Return type:
float
- lambda_U()[source]
Compute the upper tail dependence coefficient.
For the independence copula, there is no tail dependence.
- Returns:
0
- Return type:
float
- params = []
- property pdf
Compute the probability density function (PDF) of the independence copula.
For the independence copula, the PDF is constant 1 on the unit cube.
- Returns:
A wrapper around the PDF function.
- Return type:
- pdf_vectorized(*args)[source]
Vectorized implementation of the PDF for the independence copula.
- Parameters:
*args (array_like) – Arrays of dimension values to evaluate the PDF at.
- Returns:
Array of PDF values (all 1s).
- Return type:
numpy.ndarray
- rvs(n=1, random_state=None)[source]
Generate random variates from the independence copula.
For the independence copula, this simply generates independent uniform random variables.
- Parameters:
n (int, optional) – Number of samples to generate (default is 1).
random_state (int or None, optional) – Seed for the random number generator.
- Returns:
Array of shape (n, dim) containing independent uniform samples.
- Return type:
numpy.ndarray
copul.family.extreme_value.multivariate_extreme_value_copula module
- class copul.family.extreme_value.multivariate_extreme_value_copula.CallableCDFWrapper(callable_func)[source]
Bases:
objectA wrapper for Python callable functions to be used as CDF functions.
This is different from CDFWrapper and SymPyFuncWrapper which expect sympy expressions. This wrapper accepts Python callables and provides a compatible interface.
- class copul.family.extreme_value.multivariate_extreme_value_copula.MultivariateExtremeValueCopula(dimension, *args, **kwargs)[source]
Bases:
CopulaMultivariate Extreme Value Copula.
An extension of the Copula class designed for multivariate extreme value distributions. Extreme value copulas arise as the limiting distributions of component-wise maxima of random vectors.
- property cdf
Compute the cumulative distribution function (CDF) of the extreme value copula.
- Returns:
A wrapper around the CDF function.
- Return type:
- cdf_vectorized(*args)[source]
Vectorized implementation of the CDF function for improved performance with arrays.
- Parameters:
*args (array_like) – Arrays of dimension values to evaluate the CDF at.
- Returns:
Array of CDF values.
- Return type:
numpy.ndarray
- intervals = {}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params = []
copul.family.extreme_value.multivariate_gumbel_hougaard module
- class copul.family.extreme_value.multivariate_gumbel_hougaard.MultivariateGumbelHougaard(dimension=2, *args, **kwargs)[source]
Bases:
MultivariateExtremeValueCopulaMultivariate Gumbel-Hougaard Extreme Value Copula.
A specialized extreme value copula with the form: C(u₁, u₂, …, uₙ) = exp(-((-ln u₁)^θ + (-ln u₂)^θ + … + (-ln uₙ)^θ)^(1/θ))
Special cases: - θ = 1: Independence copula - θ → ∞: Comonotonicity copula (perfect positive dependence)
- Parameters:
dimension (int) – Dimension of the copula (number of variables).
theta (float, optional) – Dependence parameter (default is None). Must be greater than or equal to 1.
- property cdf
C(u1,…,ud) = exp(-((sum_j (-log uj)^theta)^(1/theta))) With boundary handling:
if any u_j == 0 -> 0
if all u_j == 1 -> 1
else -> interior expression
- intervals = {'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
The Gumbel-Hougaard copula is absolutely continuous.
- Returns:
True
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
The Gumbel-Hougaard copula is symmetric in all its arguments.
- Returns:
True
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Kendall’s tau for the multivariate Gumbel-Hougaard copula.
For the bivariate case, Kendall’s tau is (θ-1)/θ. For higher dimensions, the pairwise Kendall’s tau is the same for any pair.
- Parameters:
*args – Parameters for the copula.
**kwargs – Parameters for the copula.
- Returns:
Kendall’s tau value or expression.
- Return type:
float or sympy.Expr
- params = [theta]
- theta = theta
- copul.family.extreme_value.multivariate_gumbel_hougaard.MultivariateGumbelHougaardEV
alias of
MultivariateGumbelHougaard
copul.family.extreme_value.t_ev module
- class copul.family.extreme_value.t_ev.tEV(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaStudent-t Extreme Value Copula.
- Parameters:
nu (float) – Degrees of freedom, nu > 0
rho (float) – Correlation parameter, -1 < rho < 1
- dim: int
- intervals: dict = {'nu': Interval.open(0, oo), 'rho': Interval.open(-1, 1)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- nu = nu
- params: list = [nu, rho]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
- property pickands
Return the Pickands dependence function with parameter values substituted.
- Returns:
A wrapper that supports evaluation at \(t\) values and symbolic use.
- Return type:
- rho = rho
copul.family.extreme_value.tawn module
- class copul.family.extreme_value.tawn.Tawn(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- alpha_1 = alpha_1
- alpha_2 = alpha_2
- property cdf
Cumulative distribution function of the copula.
- Returns:
Wrapper around the symbolic CDF expression.
- Return type:
- dim: int
- intervals: dict = {'alpha_1': Interval(0, 1), 'alpha_2': Interval(0, 1), 'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [alpha_1, alpha_2, theta]
- theta = theta
Module contents
- class copul.family.extreme_value.BB5(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- cdf(u=None, v=None, **kwargs)[source]
Evaluate the CDF numerically via cdf_vectorized.
The symbolic CDF of the BB5 copula contains deeply nested logarithms and powers that are prohibitively slow to evaluate through SymPy’s
evalf. This override routes all concrete (u, v) evaluations to the fast numpy path.
- delta = delta
- dim: int
- intervals: dict = {'delta': Interval.open(0, oo), 'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [theta, delta]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
- theta = theta
- class copul.family.extreme_value.CuadrasAuge(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaCuadras-Auge copula, special case of the Marshall-Olkin copula.
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Cuadras-Augé copula.
\[\beta = 4\,C(\tfrac12,\tfrac12) - 1 = 4\cdot 2^{-\delta}\cdot 2^{-(2-2\delta)} - 1 = 2^{2-\delta} \cdot 2^{-2+2\delta}\cdot 4 - 1 \;=\; 2^{\delta} - 1\]
- chatterjees_xi(*args, **kwargs)[source]
Compute Chatterjee’s xi correlation measure.
This method sets the parameters, computes intermediate integrals, and returns the simplified expression for xi.
- Returns:
A wrapper around the symbolic expression for Chatterjee’s xi.
- Return type:
- cond_distr_1(u=None, v=None)[source]
First conditional distribution \(\partial C/\partial u\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial u\).
- Return type:
float
- delta = delta
- dim: int
- gini_gamma(*args, **kwargs)[source]
Gini’s \(\gamma\) for the Cuadras-Augé copula.
\[\gamma = 4\!\left[\int_0^1 C(t,t)\,dt + \int_0^1 C(t,1{-}t)\,dt\right] - 2\]For the CA copula, \(C(t,t) = t^{2-\delta}\) (since \(\min(t,t)=t\)), so the diagonal integral is \(1/(3-\delta)\). The anti-diagonal \(C(t,1-t)\) requires splitting at \(t=1/2\).
- hoeffdings_d(*args, **kwargs)[source]
Hoeffding’s \(D\) for the Cuadras-Augé copula.
Expanding the double integral \(90\iint(C-uv)^2\,du\,dv\) over the two regions \(\{v \le u\}\) and \(\{u < v\}\) (using symmetry) gives:
\[D(\delta) = \frac{10\,\delta^{2}} {18 - 9\,\delta + \delta^{2}}\]which satisfies \(D(0)=0\) and \(D(1)=1\).
- intervals: dict = {'delta': Interval(0, 1)}
- property is_absolutely_continuous
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Spearman’s \(\rho\).
- Returns:
Symbolic expression of Spearman’s \(\rho\).
- Return type:
sympy.Expr
- params: list = [delta]
- property pdf
Probability density function of the copula.
- Returns:
Wrapper around the symbolic or numerical PDF.
- Return type:
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Cuadras-Augé copula.
The CA copula is PQD for all \(\delta \in (0,1]\), so \(\sigma = \rho_S = 3\delta/(4-\delta)\).
- class copul.family.extreme_value.Galambos(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaGalambos extreme value copula with parameter \(\delta > 0\).
- CDF:
C(u,v) = u v exp( ((-log u)^(-delta) + (-log v)^(-delta))^(-1/delta) )
for (u,v) in (0,1]^2, with the usual boundary extensions.
- delta = delta
- dim: int
- intervals: dict = {'delta': Interval.open(0, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [delta]
- property pdf
Numerical PDF via finite differences on cdf_vectorized.
- class copul.family.extreme_value.GumbelHougaardEV(*args, **kwargs)[source]
Bases:
MultivariateGumbelHougaard,BivExtremeValueCopulaBivariate Gumbel-Hougaard Extreme Value Copula.
A specialized version of the multivariate Gumbel-Hougaard copula for the bivariate case. This copula combines features of both the bivariate extreme value copula and the multivariate Gumbel-Hougaard copula.
The CDF is given by: C(u,v) = exp(-(((-ln u)^θ + (-ln v)^θ)^(1/θ)))
Special cases: - θ = 1: Independence copula - θ → ∞: Comonotonicity copula (perfect positive dependence)
- Parameters:
theta (float, optional) – Dependence parameter (default is None). Must be greater than or equal to 1.
- dim: int
- intervals: dict = {'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
The Gumbel-Hougaard copula is absolutely continuous.
- Returns:
True
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
The Gumbel-Hougaard copula is symmetric.
- Returns:
True
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Kendall’s tau for the Gumbel-Hougaard copula.
For the Gumbel-Hougaard copula, Kendall’s tau has the closed form (θ-1)/θ.
- Parameters:
*args – Parameters for the copula.
**kwargs – Parameters for the copula.
- Returns:
Kendall’s tau value or expression.
- Return type:
float or sympy.Expr
- params: list = [theta]
- theta = theta
- class copul.family.extreme_value.HueslerReiss(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaHüsler–Reiss extreme value copula with parameter \(\delta \ge 0\). When \(\delta=0\), it reduces to the independence copula.
- cdf_vectorized(u, v)[source]
Vectorized implementation of the Hüsler–Reiss copula CDF:
C(u,v) = (u * v)^A(t), where t = ln(v) / ln(u*v), A(t) = (1 - t)*Φ(z(1 - t)) + t*Φ(z(t)), z(x) = 1/delta + (delta/2)*ln(x/(1 - x)).
- delta = delta
- dim: int
- intervals: dict = {'delta': Interval(0, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [delta]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
- class copul.family.extreme_value.JoeEV(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- alpha_1 = alpha_1
- alpha_2 = alpha_2
- cdf(u=None, v=None, **kwargs)[source]
Evaluate the CDF numerically via cdf_vectorized.
The symbolic CDF of the JoeEV copula contains deeply nested logarithms and powers that are slow to evaluate through SymPy’s
evalf. This override routes all concrete (u, v) evaluations to the fast numpy path.
- delta = delta
- dim: int
- intervals: dict = {'alpha_1': Interval(0, 1), 'alpha_2': Interval(0, 1), 'delta': Interval.open(0, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [alpha_1, alpha_2, delta]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
- class copul.family.extreme_value.MarshallOlkin(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- property alpha_1
- property alpha_2
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Marshall-Olkin copula.
\[\beta = 4\,C(\tfrac12,\tfrac12) - 1 = 4 \cdot 2^{-\max(\alpha_1,\alpha_2)} \cdot (\tfrac14)^{1-?} - 1\]Uses the general \(4C(1/2,1/2)-1\) formula directly.
- chatterjees_xi(*args, **kwargs)[source]
Compute Chatterjee’s xi correlation measure.
This method sets the parameters, computes intermediate integrals, and returns the simplified expression for xi.
- Returns:
A wrapper around the symbolic expression for Chatterjee’s xi.
- Return type:
- cond_distr_1(u=None, v=None)[source]
First conditional distribution \(\partial C/\partial u\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial u\).
- Return type:
float
- cond_distr_2(u=None, v=None)[source]
Second conditional distribution \(\partial C/\partial v\).
Uses exact boundary values where possible, otherwise numerical finite differences on
cdf_vectorized().- Parameters:
u (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.v (float or tuple) – Evaluation point in \([0,1]^2\). If
uis a tuple/list(u_val, v_val)andvisNone, the values are unpacked automatically.
- Returns:
Value of \(\partial C(u,v)/\partial v\).
- Return type:
float
- dim: int
- intervals: dict = {'alpha_1': Interval(0, 1), 'alpha_2': Interval(0, 1)}
- property is_absolutely_continuous
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Compute Spearman’s \(\rho\).
- Returns:
Symbolic expression of Spearman’s \(\rho\).
- Return type:
sympy.Expr
- params: list = [alpha_1, alpha_2]
- property pdf
Probability density function of the copula.
- Returns:
Wrapper around the symbolic or numerical PDF.
- Return type:
- copul.family.extreme_value.MarshallOlkinDiag()[source]
Creates a Marshall-Olkin copula with alpha_1 = alpha_2
- class copul.family.extreme_value.Tawn(*args, **kwargs)[source]
Bases:
BivExtremeValueCopula- alpha_1 = alpha_1
- alpha_2 = alpha_2
- property cdf
Cumulative distribution function of the copula.
- Returns:
Wrapper around the symbolic CDF expression.
- Return type:
- dim: int
- intervals: dict = {'alpha_1': Interval(0, 1), 'alpha_2': Interval(0, 1), 'theta': Interval(1, oo)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- params: list = [alpha_1, alpha_2, theta]
- theta = theta
- class copul.family.extreme_value.tEV(*args, **kwargs)[source]
Bases:
BivExtremeValueCopulaStudent-t Extreme Value Copula.
- Parameters:
nu (float) – Degrees of freedom, nu > 0
rho (float) – Correlation parameter, -1 < rho < 1
- dim: int
- intervals: dict = {'nu': Interval.open(0, oo), 'rho': Interval.open(-1, 1)}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
Must be implemented by subclasses.
- Return type:
bool
- nu = nu
- params: list = [nu, rho]
- property pdf
Numerical PDF via finite-difference on cdf_vectorized.
- property pickands
Return the Pickands dependence function with parameter values substituted.
- Returns:
A wrapper that supports evaluation at \(t\) values and symbolic use.
- Return type:
- rho = rho