Extensions¶
extensions
¶
Extensions module for advanced HeavyTails functionality.
This module contains advanced features and extensions that build upon the core library functionality.
ExtremeValueCopula
¶
Bases: HeavyTailCopula
Extreme value copulas for modeling extremal dependence.
Supported types: - Gumbel copula (upper tail dependence) - Clayton copula (lower tail dependence) - Frank copula (symmetric dependence)
Source code in heavytails/extensions.py
cdf
¶
Calculate the copula cumulative distribution function.
Formulas: - Gumbel: C(u,v) = exp(-[(-ln u)^θ + (-ln v)θ](1/θ)) - Clayton: C(u,v) = (u^(-θ) + v^(-θ) - 1)^(-1/θ) - Frank: C(u,v) = -1/θ * ln(1 + (e(-θu)-1)(e(-θv)-1)/(e^(-θ)-1))
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
list[float]
|
Vector of uniform margins in [0,1]^2 |
required |
Returns:
| Type | Description |
|---|---|
float
|
Copula CDF at point (u, v) |
Source code in heavytails/extensions.py
pdf
¶
Calculate the copula probability density function.
The PDF is the second partial derivative of the CDF: c(u,v) = ∂²C(u,v) / (∂u ∂v)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
list[float]
|
Vector of uniform margins in (0,1)^2 |
required |
Returns:
| Type | Description |
|---|---|
float
|
Copula density at point (u, v) |
Source code in heavytails/extensions.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | |
tail_dependence_coefficient
¶
Calculate upper and lower tail dependence coefficients.
Tail dependence measures the probability of joint extreme events: - Upper tail dependence (λ_U): P(V > v | U > u) as u,v → 1 - Lower tail dependence (λ_L): P(V ≤ v | U ≤ u) as u,v → 0
Formulas: - Gumbel: λ_U = 2 - 2^(1/θ), λ_L = 0 - Clayton: λ_U = 0, λ_L = 2^(-1/θ) - Frank: λ_U = λ_L = 0
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
Tuple of (upper_tail_dependence, lower_tail_dependence) |
Source code in heavytails/extensions.py
HeavyTailCopula
¶
Bases: ABC
Abstract base class for copulas with heavy-tailed marginal distributions.
Applications: - Portfolio risk modeling - Insurance dependency modeling - Multivariate extreme value theory - Credit risk assessment
Source code in heavytails/extensions.py
cdf
abstractmethod
¶
StudentTCopula
¶
Bases: HeavyTailCopula
Student-t copula for modeling tail dependence.
.. note::
The multivariate Student-t this needs now exists, in
:mod:heavytails.multivariate, along with the closed-form coefficient
of tail dependence. The copula itself is still open (#306); what
happens to this module is open separately (#312).
Particularly useful for: - Financial asset correlations during crises - Insurance claims with common shocks - Environmental extremes
Source code in heavytails/extensions.py
cdf
¶
Calculate the t-copula cumulative distribution function.
This requires numerical integration and is computationally intensive for dimensions > 3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
list[float]
|
Vector of uniform margins in [0,1]^d |
required |
Returns:
| Type | Description |
|---|---|
float
|
Copula CDF at point u |
Source code in heavytails/extensions.py
pdf
¶
Calculate the t-copula probability density function.
Formula: c(u) = f_nu,R(t_nu^{-1}(u)) / prod_i f_nu(t_nu^{-1}(u_i))
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
list[float]
|
Vector of uniform margins in [0,1]^d |
required |
Returns:
| Type | Description |
|---|---|
float
|
Copula density at point u |