copul.family.archimedean package
Submodules
copul.family.archimedean.archimedean_copula module
- class copul.family.archimedean.archimedean_copula.ArchimedeanCopula(*args, **kwargs)[source]
Bases:
Copula,ABCGeneral Archimedean Copula base class.
This class provides the foundation for Archimedean copulas of any dimension. It handles generator functions, parameter validation, and special cases.
Archimedean copulas are defined by a generator function φ and have the form: C(u₁, u₂, …, uₙ) = φ⁻¹(φ(u₁) + φ(u₂) + … + φ(uₙ))
- compute_gen_max()[source]
Compute the maximum value of the generator function.
- Returns:
The maximum value of the generator
- Return type:
float or sympy expression
- classmethod create(*args, **kwargs)[source]
Factory method to create the appropriate copula instance based on parameters.
- classmethod from_generator(generator, params=None)[source]
Create an Archimedean copula from a generator function.
- Parameters:
generator (str or sympy expression) – The generator function φ
params (list or None) – List of parameters if needed
- Returns:
A new copula instance using the provided generator
- Return type:
- property generator
The generator function with proper edge case handling. Subclasses should implement _raw_generator instead of _generator.
- Returns:
The generator function φ
- Return type:
- property intervals
Return the parameter intervals for the copula.
- Returns:
A dictionary mapping parameter names to their corresponding intervals. For example, if
self.theta_intervalis defined, returns{"theta": self.theta_interval}; otherwise, returns an empty dictionary.- Return type:
dict
- property inv_generator
The inverse generator function with proper edge case handling. Uses _raw_inv_generator from subclasses.
- Returns:
The inverse generator function φ⁻¹
- Return type:
- invalid_params = {}
- abstractmethod is_absolutely_continuous() bool[source]
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- property is_symmetric: bool
Check if the copula is symmetric.
- Returns:
True if the copula is symmetric, False otherwise
- Return type:
bool
- params = [theta]
- special_cases = {}
- t = t
- theta = theta
- theta_interval = None
- property theta_max
Maximum value of the parameter theta.
- Returns:
The maximum value of theta
- Return type:
float or sympy expression
- property theta_min
Minimum value of the parameter theta.
- Returns:
The minimum value of theta
- Return type:
float or sympy expression
- y = y
- copul.family.archimedean.archimedean_copula.from_generator(generator, params=None)[source]
Create an Archimedean copula from a generator function.
- Parameters:
generator (str or sympy expression) – The generator function φ
params (list or None) – List of parameters if needed
- Returns:
A new copula instance using the provided generator
- Return type:
copul.family.archimedean.biv_archimedean_copula module
- class copul.family.archimedean.biv_archimedean_copula.BivArchimedeanCopula(*args, **kwargs)[source]
Bases:
ArchimedeanCopula,BivCoreCopula,ABCBivariate Archimedean Copula implementation.
This class extends the general ArchimedeanCopula for the bivariate case, providing specific methods for 2D dependence measures, visualization, and analysis.
The bivariate Archimedean copula has the form: C(u,v) = φ⁻¹(φ(u) + φ(v))
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for Archimedean copulas.
Uses the generator-based formula:
\[\beta = 4\,\varphi^{[-1]}\!\bigl(2\,\varphi(\tfrac12)\bigr) - 1\]where \(\varphi\) is the generator and \(\varphi^{[-1]}\) is the (pseudo-)inverse generator.
- Return type:
float or sympy.Expr
- cdf_vectorized(u, v)[source]
Vectorized implementation of the cumulative distribution function. This simplified version leverages NumPy broadcasting for cleaner and more efficient code.
- property ci_char
Calculate the CI (conditional independence) characteristic.
- Returns:
The CI characteristic
- Return type:
- diff2_ltd_char()[source]
Calculate the second derivative of the LTD characteristic.
- Returns:
The second derivative of the LTD characteristic
- Return type:
sympy expression
- property dim: int
Return the dimension of the copula.
- Returns:
Always 2 for bivariate copulas
- Return type:
int
- first_deriv_of_ci_char()[source]
Calculate the first derivative of the CI characteristic.
- Returns:
The first derivative of the CI characteristic
- Return type:
sympy expression
- property first_deriv_of_inv_gen
First derivative of the inverse generator function.
- Returns:
The derivative φ⁻¹’(y)
- Return type:
sympy expression
- first_deriv_of_tp2_char()[source]
Calculate the first derivative of the TP2 characteristic.
- Returns:
The first derivative of the TP2 characteristic
- Return type:
sympy expression
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the bivariate Archimedean copula.
Kendall’s tau is a measure of concordance. For Archimedean copulas, it can be calculated using the generator function.
- Returns:
Kendall’s tau value
- Return type:
float or sympy expression
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- property log2_der
Calculate the second logarithmic derivative.
- Returns:
A tuple containing the second log derivative and related values
- Return type:
tuple
- property log_der
Calculate the logarithmic derivative.
- Returns:
A tuple containing the log derivative and related values
- Return type:
tuple
- ltd_char()[source]
Calculate the LTD (left-tail decreasing) characteristic.
- Returns:
The LTD characteristic
- Return type:
sympy expression
- property pdf
Probability density function of the bivariate copula.
- Returns:
The PDF function c(u,v)
- Return type:
sympy expression
- plot_generator(start=0, stop=1)[source]
Plot the generator and inverse generator functions.
- Parameters:
start (float, optional) – Start value for the x-axis
stop (float, optional) – End value for the x-axis
- second_deriv_of_ci_char()[source]
Calculate the second derivative of the CI characteristic.
- Returns:
The second derivative of the CI characteristic
- Return type:
sympy expression
- property second_deriv_of_inv_gen
Second derivative of the inverse generator function.
- Returns:
The second derivative φ⁻¹’’(y)
- Return type:
sympy expression
- second_deriv_of_tp2_char()[source]
Calculate the second derivative of the TP2 characteristic.
- Returns:
The second derivative of the TP2 characteristic
- Return type:
sympy expression
- tail_order()[source]
Tail order for Archimedean copulas.
Lower tail order:
\[\kappa_L = \lim_{s\to\infty} \frac{\log\,\varphi^{[-1]}(2s)}{\log\,\varphi^{[-1]}(s)}\]Upper tail order is determined via the survival copula.
Computed numerically from the generator.
- Returns:
{"lower": kappa_L, "upper": kappa_U}- Return type:
dict
copul.family.archimedean.heavy_compute_arch module
copul.family.archimedean.multivar_arch_independence module
- class copul.family.archimedean.multivar_arch_independence.MultivariateArchimedeanIndependence(*args, **kwargs)[source]
Bases:
ArchimedeanCopula,IndependenceCopulaMultivariate Independence Copula as an Archimedean Copula.
This class represents the independence copula as a special case of an Archimedean copula with generator function φ(t) = -log(t).
The independence copula represents statistical independence between random variables: C(u₁, u₂, …, uₙ) = u₁ × u₂ × … × uₙ
- Parameters:
dimension (int, optional) – Dimension of the copula (number of variables). Default is 2.
- 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
- t = t
- y = y
- copul.family.archimedean.multivar_arch_independence.register_independence_special_case(archimedean_class, independence_param_value)[source]
Register the MultivariateArchimedeanIndependence class as a special case of an Archimedean copula family.
- Parameters:
archimedean_class (class) – The Archimedean copula class to register with.
independence_param_value (float or int) – The parameter value that corresponds to independence.
copul.family.archimedean.multivariate_clayton module
- class copul.family.archimedean.multivariate_clayton.MultivariateClayton(*args, **kwargs)[source]
Bases:
ArchimedeanCopulaMultivariate Clayton Copula implementation.
The Clayton copula is defined by its generator: φ(t) = (t^(-θ) - 1) / θ for θ > 0 φ(t) = -log(t) for θ = 0
- Parameters:
theta (float) – The parameter controlling the strength of dependence. θ > 0 indicates positive dependence, θ = 0 gives independence.
dimension (int, optional) – The dimension of the copula (default is 2).
- cdf(*args)[source]
Cumulative distribution function of the multivariate Clayton copula.
- Parameters:
*args (float) – The uniform marginals u₁, u₂, …, uₙ
- Returns:
The CDF value
- Return type:
- cdf_vectorized(*args)[source]
Vectorized implementation of the CDF for multivariate Clayton copula.
- Parameters:
*args (array_like) – The uniform marginals as numpy arrays
- Returns:
The CDF values
- Return type:
numpy.ndarray
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True for Clayton with θ ≥ 0
- Return type:
bool
- lambda_L()[source]
Lower tail dependence coefficient.
For Clayton copula with θ > 0, this is 2^(-1/θ).
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Upper tail dependence coefficient.
For Clayton copula, this is always 0.
- Returns:
Always 0 for Clayton
- Return type:
float
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(0, oo)
copul.family.archimedean.nelsen1 module
- class copul.family.archimedean.nelsen1.BivClayton(*args, **kwargs)[source]
Bases:
BivArchimedeanCopulaBivariate Clayton Copula.
The Clayton copula is defined by its generator: φ(t) = (t^(-θ) - 1) / θ for θ > 0 φ(t) = -log(t) for θ = 0 φ(t) = (t^(-θ) - 1) / θ for θ ∈ [-1, 0) with restricted range
It allows for asymptotic lower tail dependence but no upper tail dependence.
- Parameters:
theta (float) – The parameter controlling the strength of dependence. θ > 0 indicates positive dependence, θ = 0 gives independence, and θ ∈ [-1, 0) gives negative dependence.
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Clayton copula.
\[\beta = 4\,(2^{-\theta}+2^{-\theta}-1)^{-1/\theta}\cdot \bigl[(\text{at } u=v=\tfrac12)\bigr] - 1\]For \(\theta > 0\):
\[C(\tfrac12,\tfrac12) = (2^{1-\theta}-1)^{-1/\theta} \cdot 2^{-1} \;\Longrightarrow\; \beta = 4\,(2\cdot 2^{-\theta}-1)^{-1/\theta} - 1\]
- cond_distr_1(u=None, v=None)[source]
First conditional distribution function: ∂C(u,v)/∂u
- Parameters:
u (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
v (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
- Returns:
The conditional distribution
- Return type:
- cond_distr_2(u=None, v=None)[source]
Second conditional distribution function: ∂C(u,v)/∂v
- Parameters:
u (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
v (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
- Returns:
The conditional distribution
- Return type:
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True for θ ≥ 0, False otherwise
- Return type:
bool
- lambda_L()[source]
Lower tail dependence coefficient.
For Clayton copula with θ > 0, this is 2^(-1/θ).
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Upper tail dependence coefficient.
For Clayton copula, this is always 0.
- Returns:
Always 0 for Clayton
- Return type:
float
- property pdf
Probability density function of the bivariate Clayton copula.
- Returns:
The PDF function c(u,v)
- Return type:
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Generate random samples from the Clayton copula using a fast, vectorized algorithm.
This method overrides the slow, iterative solver from the parent class. It uses a numerically stable, closed-form inverse of the conditional distribution, allowing for thousands of samples to be generated almost instantly.
- Parameters:
n (int) – Number of samples to generate.
random_state (int, optional) – Seed for the random number generator for reproducibility.
approximate (bool) – This parameter is ignored as the exact vectorized method is always fast.
- Returns:
Array of shape (n, 2) containing the generated samples.
- Return type:
numpy.ndarray
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Clayton copula.
For \(\theta \ge 0\) the Clayton copula is PQD so \(\sigma = \rho_S\). For \(\theta \in [-1,0)\) it is NQD so \(\sigma = -\rho_S\). In both cases \(\sigma = |\rho_S|\).
- special_cases = {-1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>, 0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(-1, oo)
- copul.family.archimedean.nelsen1.Clayton
alias of
BivClayton
- copul.family.archimedean.nelsen1.Nelsen1
alias of
BivClayton
copul.family.archimedean.nelsen10 module
- class copul.family.archimedean.nelsen10.Nelsen10(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
copul.family.archimedean.nelsen11 module
- class copul.family.archimedean.nelsen11.Nelsen11(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 0.500000000000000)
copul.family.archimedean.nelsen12 module
- class copul.family.archimedean.nelsen12.Nelsen12(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta = theta
- theta_interval = Interval(1, oo)
copul.family.archimedean.nelsen13 module
- class copul.family.archimedean.nelsen13.Nelsen13(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, oo)
copul.family.archimedean.nelsen14 module
- class copul.family.archimedean.nelsen14.Nelsen14(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta = theta
- theta_interval = Interval(1, oo)
copul.family.archimedean.nelsen15 module
- class copul.family.archimedean.nelsen15.GenestGhoudi(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(1, oo)
- copul.family.archimedean.nelsen15.Nelsen15
alias of
GenestGhoudi
copul.family.archimedean.nelsen16 module
- class copul.family.archimedean.nelsen16.Nelsen16(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- first_deriv_of_ci_char()[source]
Calculate the first derivative of the CI characteristic.
- Returns:
The first derivative of the CI characteristic
- Return type:
sympy expression
- property generator
The generator function with proper edge case handling. Subclasses should implement _raw_generator instead of _generator.
- Returns:
The generator function φ
- Return type:
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- second_deriv_of_ci_char()[source]
Calculate the second derivative of the CI characteristic.
- Returns:
The second derivative of the CI characteristic
- Return type:
sympy expression
- special_cases = {0: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(0, oo)
copul.family.archimedean.nelsen17 module
- class copul.family.archimedean.nelsen17.Nelsen17(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property first_deriv_of_ci_char
Calculate the first derivative of the CI characteristic.
- Returns:
The first derivative of the CI characteristic
- Return type:
sympy expression
- property first_deriv_of_inv_gen
First derivative of the inverse generator function.
- Returns:
The derivative φ⁻¹’(y)
- Return type:
sympy expression
- first_deriv_of_tp2_char()[source]
Calculate the first derivative of the TP2 characteristic.
- Returns:
The first derivative of the TP2 characteristic
- Return type:
sympy expression
- invalid_params = {0}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- property pdf
Probability density function of the bivariate copula.
- Returns:
The PDF function c(u,v)
- Return type:
sympy expression
- property second_deriv_of_inv_gen
Second derivative of the inverse generator function.
- Returns:
The second derivative φ⁻¹’’(y)
- Return type:
sympy expression
- second_deriv_of_tp2_char()[source]
Calculate the second derivative of the TP2 characteristic.
- Returns:
The second derivative of the TP2 characteristic
- Return type:
sympy expression
- special_cases = {-1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(-oo, oo)
copul.family.archimedean.nelsen18 module
- class copul.family.archimedean.nelsen18.Nelsen18(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- theta = theta
- theta_interval = Interval(2, oo)
copul.family.archimedean.nelsen19 module
- class copul.family.archimedean.nelsen19.Nelsen19(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta = theta
- theta_interval = Interval(0, oo)
copul.family.archimedean.nelsen2 module
- class copul.family.archimedean.nelsen2.Nelsen2(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- theta = theta
- theta_interval = Interval(1, oo)
copul.family.archimedean.nelsen20 module
- class copul.family.archimedean.nelsen20.Nelsen20(*args, **kwargs)[source]
Bases:
HeavyComputeArch- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, oo)
copul.family.archimedean.nelsen21 module
- class copul.family.archimedean.nelsen21.Nelsen21(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(1, oo)
copul.family.archimedean.nelsen22 module
- class copul.family.archimedean.nelsen22.Nelsen22(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- compute_gen_max()[source]
Compute the maximum value of the generator function.
- Returns:
The maximum value of the generator
- Return type:
float or sympy expression
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
copul.family.archimedean.nelsen3 module
- class copul.family.archimedean.nelsen3.AliMikhailHaq(*args, **kwargs)[source]
Bases:
BivArchimedeanCopulaAli-Mikhail-Haq copula (Nelsen 3)
- ac
alias of
BivArchimedeanCopula
- 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]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the bivariate Archimedean copula.
Kendall’s tau is a measure of concordance. For Archimedean copulas, it can be calculated using the generator function.
- Returns:
Kendall’s tau value
- Return type:
float or sympy expression
- spearmans_rho(*args, **kwargs)[source]
Compute Spearman’s rho correlation measure.
This method sets the parameters, computes the corresponding integral, and returns the simplified expression for Spearman’s rho.
- Returns:
The symbolic expression for Spearman’s rho.
- Return type:
sympy.Expr
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>, 1: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta_interval = Interval(-1, 1)
- copul.family.archimedean.nelsen3.Nelsen3
alias of
AliMikhailHaq
copul.family.archimedean.nelsen4 module
- class copul.family.archimedean.nelsen4.GumbelHougaard(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Gumbel-Hougaard copula.
\[\beta = 4\,(2^{-1/\theta} + 2^{-1/\theta} - 1)^{1/\theta}\cdot ... - 1\]The diagonal section \(C(t,t) = t^{2-2^{1-1/\theta}}\) is NOT exact for GH (it uses the Pickands form). Evaluate directly:
\[C(\tfrac12,\tfrac12) = \exp\!\bigl(-[(-\ln\tfrac12)^\theta + (-\ln\tfrac12)^\theta]^{1/\theta}\bigr) = \exp\bigl(-2^{1/\theta}\ln 2\bigr) = 2^{-2^{1/\theta}}\]
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Fast vectorized Marshall–Olkin sampler for Gumbel–Hougaard.
- Steps:
α = 1/θ
Sample V ~ positive α-stable via Kanter’s method
Sample E1,E2 ~ Exp(1) i.i.d.
Return (U, V) with U = exp(-(E1/V)^α), V = exp(-(E2/V)^α)
Independence (θ≈1) is handled by returning U(0,1)^2 directly.
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Gumbel-Hougaard copula.
GH is PQD for \(\theta \ge 1\), so \(\sigma = \rho_S\).
- spearmans_footrule(*args, **kwargs)[source]
Compute Spearman’s footrule (ψ) for the Gumbel–Hougaard copula.
- Closed-form expression:
ψ(C_θ) = 6 / (2^(1/θ) + 1) - 2
For θ = 1 (independence), this yields ψ = 0. As θ → ∞ (comonotonicity), this yields ψ = 1.
- Returns:
Spearman’s footrule value (ψ).
- Return type:
float
- special_cases = {1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(1, oo)
- copul.family.archimedean.nelsen4.Nelsen4
alias of
GumbelHougaard
copul.family.archimedean.nelsen5 module
- class copul.family.archimedean.nelsen5.Frank(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- blests_nu()[source]
Compute Blest’s rank correlation ν.
- Uses the copula form
ν(C) = 24 ∫_0^1 ∫_0^1 (1 - u) C(u, v) du dv - 2
which is linear in C and generally symbolic-friendly.
- Returns:
The symbolic expression for Blest’s ν.
- Return type:
sympy.Expr
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Frank copula.
\[\beta = 1 - \frac{4}{\theta}\,\ln\!\cosh\!\bigl(\tfrac{\theta}{4}\bigr)\](The Frank CDF at \((1/2,1/2)\) has a neat log-cosh form.)
- cdf_vectorized(u: ndarray, v: ndarray) ndarray[source]
Vectorized implementation of the cumulative distribution function for the Frank copula.
This method uses the explicit mathematical formula for the Frank copula, which is significantly faster than the generic generator-based approach.
- Parameters:
u (array_like) – First uniform marginal, must be in [0, 1].
v (array_like) – Second uniform marginal, must be in [0, 1].
- Returns:
The CDF values at the specified points.
- Return type:
numpy.ndarray
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the Frank copula using numerical integration.
For theta = 0, returns 0 (independence).
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Generate random samples from the Frank copula using a fast, vectorized algorithm.
This method uses a numerically stable, closed-form inverse of the conditional distribution, allowing for thousands of samples to be generated almost instantly.
- Parameters:
n (int) – Number of samples to generate.
random_state (int, optional) – Seed for the random number generator for reproducibility.
approximate (bool) – This parameter is ignored as the exact vectorized method is always fast.
- Returns:
Array of shape (n, 2) containing the generated samples.
- Return type:
numpy.ndarray
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Frank copula.
The Frank copula is PQD for \(\theta > 0\) and NQD for \(\theta < 0\), so \(\sigma = |\rho_S|\).
- spearmans_rho(*args, **kwargs)[source]
Calculate Spearman’s rho for the Frank copula using numerical integration.
For theta = 0, returns 0 (independence).
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(-oo, oo)
copul.family.archimedean.nelsen6 module
- class copul.family.archimedean.nelsen6.Joe(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- cdf_vectorized(u: ndarray, v: ndarray) ndarray[source]
Vectorized implementation of the cumulative distribution function for the Joe copula.
This method uses the explicit mathematical formula for the Joe copula, which is significantly faster than the generic generator-based approach.
- Parameters:
u (array_like) – First uniform marginal, must be in [0, 1].
v (array_like) – Second uniform marginal, must be in [0, 1].
- Returns:
The CDF values at the specified points.
- Return type:
numpy.ndarray
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Generate random samples from the Joe copula using a fast, vectorized algorithm.
This method overrides the slow, iterative solver from the parent class. It uses a numerically stable, closed-form inverse of the conditional distribution, allowing for thousands of samples to be generated almost instantly.
- Parameters:
n (int) – Number of samples to generate.
random_state (int, optional) – Seed for the random number generator for reproducibility.
approximate (bool) – This parameter is ignored as the exact vectorized method is always fast.
- Returns:
Array of shape (n, 2) containing the generated samples.
- Return type:
numpy.ndarray
- special_cases = {1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(1, oo)
copul.family.archimedean.nelsen7 module
- class copul.family.archimedean.nelsen7.Nelsen7(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- 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]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the bivariate Archimedean copula.
Kendall’s tau is a measure of concordance. For Archimedean copulas, it can be calculated using the generator function.
- Returns:
Kendall’s tau value
- Return type:
float or sympy expression
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>, 1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
copul.family.archimedean.nelsen8 module
- class copul.family.archimedean.nelsen8.Nelsen8(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(1, oo)
copul.family.archimedean.nelsen9 module
- class copul.family.archimedean.nelsen9.GumbelBarnett(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
- copul.family.archimedean.nelsen9.Nelsen9
alias of
GumbelBarnett
Module contents
- class copul.family.archimedean.AliMikhailHaq(*args, **kwargs)[source]
Bases:
BivArchimedeanCopulaAli-Mikhail-Haq copula (Nelsen 3)
- ac
alias of
BivArchimedeanCopula
- 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]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the bivariate Archimedean copula.
Kendall’s tau is a measure of concordance. For Archimedean copulas, it can be calculated using the generator function.
- Returns:
Kendall’s tau value
- Return type:
float or sympy expression
- spearmans_rho(*args, **kwargs)[source]
Compute Spearman’s rho correlation measure.
This method sets the parameters, computes the corresponding integral, and returns the simplified expression for Spearman’s rho.
- Returns:
The symbolic expression for Spearman’s rho.
- Return type:
sympy.Expr
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>, 1: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta_interval = Interval(-1, 1)
- class copul.family.archimedean.BivClayton(*args, **kwargs)[source]
Bases:
BivArchimedeanCopulaBivariate Clayton Copula.
The Clayton copula is defined by its generator: φ(t) = (t^(-θ) - 1) / θ for θ > 0 φ(t) = -log(t) for θ = 0 φ(t) = (t^(-θ) - 1) / θ for θ ∈ [-1, 0) with restricted range
It allows for asymptotic lower tail dependence but no upper tail dependence.
- Parameters:
theta (float) – The parameter controlling the strength of dependence. θ > 0 indicates positive dependence, θ = 0 gives independence, and θ ∈ [-1, 0) gives negative dependence.
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Clayton copula.
\[\beta = 4\,(2^{-\theta}+2^{-\theta}-1)^{-1/\theta}\cdot \bigl[(\text{at } u=v=\tfrac12)\bigr] - 1\]For \(\theta > 0\):
\[C(\tfrac12,\tfrac12) = (2^{1-\theta}-1)^{-1/\theta} \cdot 2^{-1} \;\Longrightarrow\; \beta = 4\,(2\cdot 2^{-\theta}-1)^{-1/\theta} - 1\]
- cond_distr_1(u=None, v=None)[source]
First conditional distribution function: ∂C(u,v)/∂u
- Parameters:
u (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
v (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
- Returns:
The conditional distribution
- Return type:
- cond_distr_2(u=None, v=None)[source]
Second conditional distribution function: ∂C(u,v)/∂v
- Parameters:
u (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
v (float or None, optional) – Values to evaluate at. If None, returns the symbolic expression.
- Returns:
The conditional distribution
- Return type:
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True for θ ≥ 0, False otherwise
- Return type:
bool
- lambda_L()[source]
Lower tail dependence coefficient.
For Clayton copula with θ > 0, this is 2^(-1/θ).
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Upper tail dependence coefficient.
For Clayton copula, this is always 0.
- Returns:
Always 0 for Clayton
- Return type:
float
- property pdf
Probability density function of the bivariate Clayton copula.
- Returns:
The PDF function c(u,v)
- Return type:
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Generate random samples from the Clayton copula using a fast, vectorized algorithm.
This method overrides the slow, iterative solver from the parent class. It uses a numerically stable, closed-form inverse of the conditional distribution, allowing for thousands of samples to be generated almost instantly.
- Parameters:
n (int) – Number of samples to generate.
random_state (int, optional) – Seed for the random number generator for reproducibility.
approximate (bool) – This parameter is ignored as the exact vectorized method is always fast.
- Returns:
Array of shape (n, 2) containing the generated samples.
- Return type:
numpy.ndarray
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Clayton copula.
For \(\theta \ge 0\) the Clayton copula is PQD so \(\sigma = \rho_S\). For \(\theta \in [-1,0)\) it is NQD so \(\sigma = -\rho_S\). In both cases \(\sigma = |\rho_S|\).
- special_cases = {-1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>, 0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(-1, oo)
- copul.family.archimedean.Clayton
alias of
BivClayton
- class copul.family.archimedean.Frank(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- blests_nu()[source]
Compute Blest’s rank correlation ν.
- Uses the copula form
ν(C) = 24 ∫_0^1 ∫_0^1 (1 - u) C(u, v) du dv - 2
which is linear in C and generally symbolic-friendly.
- Returns:
The symbolic expression for Blest’s ν.
- Return type:
sympy.Expr
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Frank copula.
\[\beta = 1 - \frac{4}{\theta}\,\ln\!\cosh\!\bigl(\tfrac{\theta}{4}\bigr)\](The Frank CDF at \((1/2,1/2)\) has a neat log-cosh form.)
- cdf_vectorized(u: ndarray, v: ndarray) ndarray[source]
Vectorized implementation of the cumulative distribution function for the Frank copula.
This method uses the explicit mathematical formula for the Frank copula, which is significantly faster than the generic generator-based approach.
- Parameters:
u (array_like) – First uniform marginal, must be in [0, 1].
v (array_like) – Second uniform marginal, must be in [0, 1].
- Returns:
The CDF values at the specified points.
- Return type:
numpy.ndarray
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the Frank copula using numerical integration.
For theta = 0, returns 0 (independence).
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Generate random samples from the Frank copula using a fast, vectorized algorithm.
This method uses a numerically stable, closed-form inverse of the conditional distribution, allowing for thousands of samples to be generated almost instantly.
- Parameters:
n (int) – Number of samples to generate.
random_state (int, optional) – Seed for the random number generator for reproducibility.
approximate (bool) – This parameter is ignored as the exact vectorized method is always fast.
- Returns:
Array of shape (n, 2) containing the generated samples.
- Return type:
numpy.ndarray
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Frank copula.
The Frank copula is PQD for \(\theta > 0\) and NQD for \(\theta < 0\), so \(\sigma = |\rho_S|\).
- spearmans_rho(*args, **kwargs)[source]
Calculate Spearman’s rho for the Frank copula using numerical integration.
For theta = 0, returns 0 (independence).
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(-oo, oo)
- class copul.family.archimedean.GenestGhoudi(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(1, oo)
- class copul.family.archimedean.GumbelBarnett(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
- class copul.family.archimedean.GumbelHougaard(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- blomqvists_beta(*args, **kwargs)[source]
Blomqvist’s \(\beta\) for the Gumbel-Hougaard copula.
\[\beta = 4\,(2^{-1/\theta} + 2^{-1/\theta} - 1)^{1/\theta}\cdot ... - 1\]The diagonal section \(C(t,t) = t^{2-2^{1-1/\theta}}\) is NOT exact for GH (it uses the Pickands form). Evaluate directly:
\[C(\tfrac12,\tfrac12) = \exp\!\bigl(-[(-\ln\tfrac12)^\theta + (-\ln\tfrac12)^\theta]^{1/\theta}\bigr) = \exp\bigl(-2^{1/\theta}\ln 2\bigr) = 2^{-2^{1/\theta}}\]
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Fast vectorized Marshall–Olkin sampler for Gumbel–Hougaard.
- Steps:
α = 1/θ
Sample V ~ positive α-stable via Kanter’s method
Sample E1,E2 ~ Exp(1) i.i.d.
Return (U, V) with U = exp(-(E1/V)^α), V = exp(-(E2/V)^α)
Independence (θ≈1) is handled by returning U(0,1)^2 directly.
- schweizer_wolff_sigma(*args, **kwargs)[source]
Schweizer–Wolff \(\sigma\) for the Gumbel-Hougaard copula.
GH is PQD for \(\theta \ge 1\), so \(\sigma = \rho_S\).
- spearmans_footrule(*args, **kwargs)[source]
Compute Spearman’s footrule (ψ) for the Gumbel–Hougaard copula.
- Closed-form expression:
ψ(C_θ) = 6 / (2^(1/θ) + 1) - 2
For θ = 1 (independence), this yields ψ = 0. As θ → ∞ (comonotonicity), this yields ψ = 1.
- Returns:
Spearman’s footrule value (ψ).
- Return type:
float
- special_cases = {1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(1, oo)
- class copul.family.archimedean.Joe(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- cdf_vectorized(u: ndarray, v: ndarray) ndarray[source]
Vectorized implementation of the cumulative distribution function for the Joe copula.
This method uses the explicit mathematical formula for the Joe copula, which is significantly faster than the generic generator-based approach.
- Parameters:
u (array_like) – First uniform marginal, must be in [0, 1].
v (array_like) – Second uniform marginal, must be in [0, 1].
- Returns:
The CDF values at the specified points.
- Return type:
numpy.ndarray
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- rvs(n: int = 1, random_state: int | None = None, approximate: bool = False) ndarray[source]
Generate random samples from the Joe copula using a fast, vectorized algorithm.
This method overrides the slow, iterative solver from the parent class. It uses a numerically stable, closed-form inverse of the conditional distribution, allowing for thousands of samples to be generated almost instantly.
- Parameters:
n (int) – Number of samples to generate.
random_state (int, optional) – Seed for the random number generator for reproducibility.
approximate (bool) – This parameter is ignored as the exact vectorized method is always fast.
- Returns:
Array of shape (n, 2) containing the generated samples.
- Return type:
numpy.ndarray
- special_cases = {1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(1, oo)
- copul.family.archimedean.Nelsen1
alias of
BivClayton
- class copul.family.archimedean.Nelsen10(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
- class copul.family.archimedean.Nelsen11(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 0.500000000000000)
- class copul.family.archimedean.Nelsen12(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta = theta
- theta_interval = Interval(1, oo)
- class copul.family.archimedean.Nelsen13(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, oo)
- class copul.family.archimedean.Nelsen14(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta = theta
- theta_interval = Interval(1, oo)
- copul.family.archimedean.Nelsen15
alias of
GenestGhoudi
- class copul.family.archimedean.Nelsen16(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- first_deriv_of_ci_char()[source]
Calculate the first derivative of the CI characteristic.
- Returns:
The first derivative of the CI characteristic
- Return type:
sympy expression
- property generator
The generator function with proper edge case handling. Subclasses should implement _raw_generator instead of _generator.
- Returns:
The generator function φ
- Return type:
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- second_deriv_of_ci_char()[source]
Calculate the second derivative of the CI characteristic.
- Returns:
The second derivative of the CI characteristic
- Return type:
sympy expression
- special_cases = {0: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(0, oo)
- class copul.family.archimedean.Nelsen17(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property first_deriv_of_ci_char
Calculate the first derivative of the CI characteristic.
- Returns:
The first derivative of the CI characteristic
- Return type:
sympy expression
- property first_deriv_of_inv_gen
First derivative of the inverse generator function.
- Returns:
The derivative φ⁻¹’(y)
- Return type:
sympy expression
- first_deriv_of_tp2_char()[source]
Calculate the first derivative of the TP2 characteristic.
- Returns:
The first derivative of the TP2 characteristic
- Return type:
sympy expression
- invalid_params = {0}
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- property pdf
Probability density function of the bivariate copula.
- Returns:
The PDF function c(u,v)
- Return type:
sympy expression
- property second_deriv_of_inv_gen
Second derivative of the inverse generator function.
- Returns:
The second derivative φ⁻¹’’(y)
- Return type:
sympy expression
- second_deriv_of_tp2_char()[source]
Calculate the second derivative of the TP2 characteristic.
- Returns:
The second derivative of the TP2 characteristic
- Return type:
sympy expression
- special_cases = {-1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta_interval = Interval(-oo, oo)
- class copul.family.archimedean.Nelsen18(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- theta = theta
- theta_interval = Interval(2, oo)
- class copul.family.archimedean.Nelsen19(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.other.pi_over_sigma_minus_pi.PiOverSigmaMinusPi'>}
- theta = theta
- theta_interval = Interval(0, oo)
- class copul.family.archimedean.Nelsen2(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- theta = theta
- theta_interval = Interval(1, oo)
- class copul.family.archimedean.Nelsen20(*args, **kwargs)[source]
Bases:
HeavyComputeArch- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, oo)
- class copul.family.archimedean.Nelsen21(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(1, oo)
- class copul.family.archimedean.Nelsen22(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- compute_gen_max()[source]
Compute the maximum value of the generator function.
- Returns:
The maximum value of the generator
- Return type:
float or sympy expression
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
- copul.family.archimedean.Nelsen3
alias of
AliMikhailHaq
- copul.family.archimedean.Nelsen4
alias of
GumbelHougaard
- class copul.family.archimedean.Nelsen7(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- 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]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- cond_distr_2(u=None, v=None)[source]
\(F_{U_{-2}\mid U_2}(u_{-2}\mid u_2)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- kendalls_tau(*args, **kwargs)[source]
Calculate Kendall’s tau for the bivariate Archimedean copula.
Kendall’s tau is a measure of concordance. For Archimedean copulas, it can be calculated using the generator function.
- Returns:
Kendall’s tau value
- Return type:
float or sympy expression
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {0: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>, 1: <class 'copul.family.frechet.biv_independence_copula.BivIndependenceCopula'>}
- theta = theta
- theta_interval = Interval(0, 1)
- class copul.family.archimedean.Nelsen8(*args, **kwargs)[source]
Bases:
BivArchimedeanCopula- ac
alias of
BivArchimedeanCopula
- cond_distr_1(u=None, v=None)[source]
\(F_{U_{-1}\mid U_1}(u_{-1}\mid u_1)\).
- Parameters:
*args – See
cond_distr().**kwargs – See
cond_distr().
- property is_absolutely_continuous: bool
Check if the copula is absolutely continuous.
- Returns:
True if the copula is absolutely continuous, False otherwise
- Return type:
bool
- lambda_L()[source]
Calculate the lower tail dependence coefficient.
- Returns:
The lower tail dependence coefficient
- Return type:
float or sympy expression
- lambda_U()[source]
Calculate the upper tail dependence coefficient.
- Returns:
The upper tail dependence coefficient
- Return type:
float or sympy expression
- special_cases = {1: <class 'copul.family.frechet.lower_frechet.LowerFrechet'>}
- theta = theta
- theta_interval = Interval(1, oo)
- copul.family.archimedean.Nelsen9
alias of
GumbelBarnett