pystra.dependence.copula.FrankCopula#

Use it: User guide · Worked example · Theory

class FrankCopula(theta)[source]#

Bases: Copula

Bivariate Frank copula; theta=0 gives independence.

This initial implementation supports finite abs(theta) <= 30 to keep the exponential conditional formulas resolved in double precision.

Parameters:

theta (float) – Finite bivariate Frank dependence parameter, including zero for independence. The implementation requires abs(theta) <= 30.

Methods

cdf

Return the bivariate CDF on the closed unit square.

inverse_rosenblatt

Invert the conditional uniform map for the same conditioning order.

logpdf

Return log density in the interior of the unit square.

pdf

Evaluate the copula density at interior uniform coordinates.

rosenblatt

Map dependent uniforms to independent conditional uniforms.

rvs

Sample rows using a local NumPy random generator.

cdf(probabilities)[source]#

Return the bivariate CDF on the closed unit square.

probabilities has 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.

probabilities has 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.

probabilities has shape (2,) or (n_points, 2) and lies strictly inside the unit square. order is [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 to numpy.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