pystra.dependence.copula.FrankCopula#
Use it: User guide · Worked example · Theory
- class FrankCopula(theta)[source]#
Bases:
CopulaBivariate Frank copula; theta=0 gives independence.
This initial implementation supports finite
abs(theta) <= 30to keep the exponential conditional formulas resolved in double precision.- Parameters:
theta (
float) – Finite bivariate Frank dependence parameter, including zero for independence. The implementation requiresabs(theta) <= 30.
Methods
Return the bivariate CDF on the closed unit square.
Invert the conditional uniform map for the same conditioning order.
Return log density in the interior of the unit square.
Evaluate the copula density at interior uniform coordinates.
Map dependent uniforms to independent conditional uniforms.
Sample rows using a local NumPy random generator.
- cdf(probabilities)[source]#
Return the bivariate CDF on the closed unit square.
probabilitieshas shape(2,)or(n_points, 2). Return a scalar or one probability per row; coordinates must be finite and in [0, 1].- Return type:
float|ndarray
- logpdf(probabilities)[source]#
Return log density in the interior of the unit square.
probabilitieshas shape(2,)or(n_points, 2)with coordinates strictly between zero and one. Return one log density per point.- Return type:
float|ndarray
- rosenblatt(probabilities, order=None)[source]#
Map dependent uniforms to independent conditional uniforms.
probabilitieshas shape(2,)or(n_points, 2)and lies strictly inside the unit square.orderis[0, 1]by default or[1, 0]. The result retains the input shape and original coordinate positions.- Return type:
ndarray
- inverse_rosenblatt(probabilities, order=None)[source]#
Invert the conditional uniform map for the same conditioning order.
The input, output and ordering contracts match
rosenblatt(); input uniforms are independent and output marginals have Frank dependence.- Return type:
ndarray
- pdf(probabilities)#
Evaluate the copula density at interior uniform coordinates.
- Parameters:
probabilities (
ArrayLike) – Marginal probabilities strictly between zero and one, in original order.- Returns:
Density for one point or one value per row of points.
- Return type:
float|ndarray- Raises:
ValueError – If the coordinates have an invalid shape or lie outside the interior.
- rvs(size=1, seed=None)#
Sample rows using a local NumPy random generator.
- Parameters:
size (
int) – Nonnegative number of observations.seed (
int|integer|Sequence[int] |ndarray|SeedSequence|BitGenerator|Generator|None) – Input tonumpy.random.default_rng. A supplied generator is reused and advances; other seeds construct a local generator.
- Returns:
Uniform marginal coordinates with this copula’s dependence.
- Return type:
ndarray