Bicop

class Bicop(*args, **kwargs)

A class for bivariate copula models.

The model is fully characterized by the family, rotation (one of 0, 90, 180, 270), a matrix of parameters, and variable types (two strings, one for each variable, either "c" for continuous or "d" for discrete).

Implemented families (see BicopFamily):

| type          | full name             | string identifier     |
|---------------|-----------------------|-----------------------|
| -             | Independence          | "indep"               |
| Elliptical    | Gaussian              | "gaussian"            |
|               | Student t             | "student"             |
| Archimedean   | Clayton               | "clayton"             |
|               | Gumbel                | "gumbel"              |
|               | Frank                 | "frank"               |
|               | Joe                   | "joe"                 |
|               | Clayton-Gumbel (BB1)  | "bb1"                 |
|               | Joe-Gumbel (BB6)      | "bb6"                 |
|               | Joe-Clayton (BB7)     | "bb7"                 |
|               | Joe-Frank (BB8)       | "bb8"                 |
| Extreme-Value | Tawn                  | "tawn"                |
| Nonparametric | Transformation kernel | "tll"                 |
Attributes:
beta

Returns ——- float Blomqvist’s beta implied by the current parameters.

family

Returns ——- BicopFamily the copula family.

nobs

Returns ——- int the number of observations used to fit the copula (0 until fit() has been called).

npars

Returns ——- float the number of parameters in the copula model.

parameters

Returns ——- ndarray, shape (n, m), dtype float the copula parameter(s) as a matrix (shape depends on the family).

parameters_lower_bounds

Gets lower bounds for copula parameters.

parameters_upper_bounds

Gets upper bounds for copula parameters.

rotation

Returns ——- int the copula rotation in degrees (one of 0, 90, 180, 270).

taildep

Returns ——- ndarray, shape (n, m), dtype float the tail dependence coefficients implied by the current parameters, as a 2x2 matrix; see parameters_to_taildep().

tau

Returns ——- float Kendall’s tau implied by the current parameters.

var_types

Returns ——- list of str the variable types of the two variables (each "c" for continuous or "d" for discrete).

Methods

aic(self[, u])

Evaluates the Akaike information criterion (AIC).

bic(self[, u])

Evaluates the Bayesian information criterion (BIC).

cdf(self, u[, parameters, num_threads])

Evaluates the copula distribution.

fit(self, data[, controls])

Fits a bivariate copula (with fixed family) to data.

flip(self)

Adjusts the copula model to a change in the variable order.

from_data(data[, controls, var_types])

Instantiates from data.

from_family([family, rotation, parameters, ...])

Instantiates a specific bivariate copula model.

from_file(filename)

Instantiates from a JSON or CBOR file.

from_json(json)

Instantiates from a JSON-like str object.

gradient(self, u[, parameters, num_threads])

Evaluates the gradient of the average log-likelihood.

hessian(self, u[, parameters, num_threads])

Evaluates the Hessian of the average log-likelihood.

hessian_full(self, u[, parameters, num_threads])

Evaluates the per-observation Hessians.

hfunc1(self, u[, parameters, num_threads])

Evaluates the first h-function.

hfunc1_deriv(self, u, deriv[, parameters, ...])

Evaluates a first derivative of the first h-function \(h_1(u_1, u_2) = P(U_2 \le u_2 | U_1 = u_1)\).

hfunc1_deriv2(self, u, deriv[, parameters, ...])

Evaluates a second derivative of the first h-function.

hfunc2(self, u[, parameters, num_threads])

Evaluates the second h-function.

hfunc2_deriv(self, u, deriv[, parameters, ...])

Evaluates a first derivative of the second h-function \(h_2(u_1, u_2) = P(U_1 \le u_1 | U_2 = u_2)\).

hfunc2_deriv2(self, u, deriv[, parameters, ...])

Evaluates a second derivative of the second h-function.

hinv1(self, u[, parameters, num_threads])

Evaluates the inverse of the first h-function.

hinv2(self, u[, parameters, num_threads])

Evaluates the inverse of the second h-function.

loglik(self[, u, parameters, num_threads])

Evaluates the log-likelihood.

logpdf_deriv(self, u, deriv[, parameters, ...])

Evaluates a first derivative of the log-density \(\partial \log c / \partial \cdot\).

logpdf_deriv2(self, u, deriv[, parameters, ...])

Evaluates a second derivative of the log-density.

mbic(self[, u, psi0])

Evaluates the modified Bayesian information criterion (mBIC).

parameters_to_beta(self, parameters)

Converts the copula parameters to Blomqvist's \(\beta\).

parameters_to_taildep(self, parameters)

Converts the copula parameters to the tail dependence coefficients.

parameters_to_tau(self, parameters)

Converts the copula parameters to Kendall's \(tau\).

pdf(self, u[, parameters, num_threads])

Evaluates the copula density.

pdf_deriv(self, u, deriv[, parameters, ...])

Evaluates a first derivative of the copula density.

pdf_deriv2(self, u, deriv[, parameters, ...])

Evaluates a second derivative of the copula density.

plot(self[, type, margin_type, xylim, grid_size])

Generates a plot for the Bicop object.

scores(self, u[, parameters, num_threads])

Evaluates the per-observation scores.

scores_cov(self, u[, parameters, num_threads])

Computes the covariance matrix of the scores.

scores_full(self, u[, parameters, num_threads])

Evaluates the scores, bundled in a ScoresResult.

select(self, data[, controls])

Selects the best fitting model.

simulate(self, n[, qrng, seeds])

Simulates from a bivariate copula.

tau_to_parameters(self, tau)

Converts a Kendall's \(\tau\)into copula parameters for one-parameter families.

to_file(self, filename)

Writes the copula object into a JSON or CBOR file.

to_json(self)

Convert the copula into a nlohmann::json object.

Attributes

beta

Returns:

family

Returns:

nobs

Returns:

npars

Returns:

parameters

Returns:

parameters_lower_bounds

Gets lower bounds for copula parameters.

parameters_upper_bounds

Gets upper bounds for copula parameters.

rotation

Returns:

taildep

Returns:

tau

Returns:

var_types

Returns:

Methods

__init__

Default constructor for the Bicop class.

aic

Evaluates the Akaike information criterion (AIC).

bic

Evaluates the Bayesian information criterion (BIC).

cdf

Evaluates the copula distribution.

fit

Fits a bivariate copula (with fixed family) to data.

flip

Adjusts the copula model to a change in the variable order.

from_data

Instantiates from data.

from_family

Instantiates a specific bivariate copula model.

from_file

Instantiates from a JSON or CBOR file.

from_json

Instantiates from a JSON-like str object.

gradient

Evaluates the gradient of the average log-likelihood.

hessian

Evaluates the Hessian of the average log-likelihood.

hessian_full

Evaluates the per-observation Hessians.

hfunc1

Evaluates the first h-function.

hfunc1_deriv

Evaluates a first derivative of the first h-function \(h_1(u_1, u_2) = P(U_2 \le u_2 | U_1 = u_1)\).

hfunc1_deriv2

Evaluates a second derivative of the first h-function.

hfunc2

Evaluates the second h-function.

hfunc2_deriv

Evaluates a first derivative of the second h-function \(h_2(u_1, u_2) = P(U_1 \le u_1 | U_2 = u_2)\).

hfunc2_deriv2

Evaluates a second derivative of the second h-function.

hinv1

Evaluates the inverse of the first h-function.

hinv2

Evaluates the inverse of the second h-function.

loglik

Evaluates the log-likelihood.

logpdf_deriv

Evaluates a first derivative of the log-density \(\partial \log c / \partial \cdot\).

logpdf_deriv2

Evaluates a second derivative of the log-density.

mbic

Evaluates the modified Bayesian information criterion (mBIC).

parameters_to_beta

Converts the copula parameters to Blomqvist's \(\beta\).

parameters_to_taildep

Converts the copula parameters to the tail dependence coefficients.

parameters_to_tau

Converts the copula parameters to Kendall's \(tau\).

pdf

Evaluates the copula density.

pdf_deriv

Evaluates a first derivative of the copula density.

pdf_deriv2

Evaluates a second derivative of the copula density.

plot

Generates a plot for the Bicop object.

scores

Evaluates the per-observation scores.

scores_cov

Computes the covariance matrix of the scores.

scores_full

Evaluates the scores, bundled in a ScoresResult.

select

Selects the best fitting model.

simulate

Simulates from a bivariate copula.

tau_to_parameters

Converts a Kendall's \(\tau\)into copula parameters for one-parameter families.

to_file

Writes the copula object into a JSON or CBOR file.

to_json

Convert the copula into a nlohmann::json object.