copulas.bivariate.frank module

class copulas.bivariate.frank.Frank(copula_type=None, random_seed=None)[source]

Bases: copulas.bivariate.base.Bivariate

Class for Frank copula model.

compute_theta()[source]

Compute theta parameter using Kendall’s tau.

On Frank copula, the relationship between tau and theta is defined by:

\[\tau = 1 − \frac{4}{\theta} + \frac{4}{\theta^2}\int_0^\theta \! \frac{t}{e^t -1} \mathrm{d}t.\]

In order to solve it, we can simplify it as

\[0 = 1 + \frac{4}{\theta}(D_1(\theta) - 1) - \tau\]

where the function D is the Debye function of first order, defined as:

\[D_1(x) = \frac{1}{x}\int_0^x\frac{t}{e^t -1} \mathrm{d}t.\]
copula_type = 1
cumulative_distribution(X)[source]

Compute the cumulative distribution function for the Frank copula.

The cumulative density(cdf), or distribution function for the Frank family of copulas correspond to the formula:

\[C(u,v) = −\frac{\ln({\frac{1 + g(u) g(v)}{g(1)}})}{\theta}\]
Parameters

Xnp.ndarray

Returns

cumulative distribution

Return type

np.array

generator(t)[source]

Return the generator function.

invalid_thetas = [0]
partial_derivative(X)[source]

Compute partial derivative of cumulative distribution.

The partial derivative of the copula(CDF) is the conditional CDF.

\[F(v|u) = \frac{\partial}{\partial u}C(u,v) = \frac{g(u)g(v) + g(v)}{g(u)g(v) + g(1)}\]
Parameters
  • X (np.ndarray) –

  • y (float) –

Returns

np.ndarray

percent_point(y, V)[source]

Compute the inverse of conditional cumulative distribution \(C(u|v)^{-1}\).

Parameters
  • ynp.ndarray value of \(C(u|v)\).

  • vnp.ndarray given value of v.

probability_density(X)[source]

Compute probability density function for given copula family.

The probability density(PDF) for the Frank family of copulas correspond to the formula:

\[c(U,V) = \frac{\partial^2 C(u,v)}{\partial v \partial u} = \frac{-\theta g(1)(1 + g(u + v))}{(g(u) g(v) + g(1)) ^ 2}\]

Where the g function is defined by:

\[g(x) = e^{-\theta x} - 1\]
Parameters

Xnp.ndarray

Returns

probability density

Return type

np.array

theta_interval = [-inf, inf]