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:
betaReturns ——- float Blomqvist’s beta implied by the current parameters.
familyReturns ——- BicopFamily the copula family.
nobsReturns ——- int the number of observations used to fit the copula (
0untilfit()has been called).nparsReturns ——- float the number of parameters in the copula model.
parametersReturns ——- ndarray, shape (n, m), dtype float the copula parameter(s) as a matrix (shape depends on the family).
parameters_lower_boundsGets lower bounds for copula parameters.
parameters_upper_boundsGets upper bounds for copula parameters.
rotationReturns ——- int the copula rotation in degrees (one of
0,90,180,270).taildepReturns ——- ndarray, shape (n, m), dtype float the tail dependence coefficients implied by the current parameters, as a 2x2 matrix; see parameters_to_taildep().
tauReturns ——- float Kendall’s tau implied by the current parameters.
var_typesReturns ——- 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.
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.
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
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
Gets lower bounds for copula parameters.
Gets upper bounds for copula parameters.
- Returns:
- Returns:
- Returns:
- Returns:
Methods
Default constructor for the
Bicopclass.Evaluates the Akaike information criterion (AIC).
Evaluates the Bayesian information criterion (BIC).
Evaluates the copula distribution.
Fits a bivariate copula (with fixed family) to data.
Adjusts the copula model to a change in the variable order.
Instantiates from data.
Instantiates a specific bivariate copula model.
Instantiates from a JSON or CBOR file.
Instantiates from a JSON-like str object.
Evaluates the first h-function.
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)\).
Evaluates a second derivative of the first h-function.
Evaluates the second h-function.
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)\).
Evaluates a second derivative of the second h-function.
Evaluates the inverse of the first h-function.
Evaluates the inverse of the second h-function.
Evaluates the log-likelihood.
Evaluates a first derivative of the log-density \(\partial \log c / \partial \cdot\).
Evaluates a second derivative of the log-density.
Evaluates the modified Bayesian information criterion (mBIC).
Converts the copula parameters to Blomqvist's \(\beta\).
Converts the copula parameters to the tail dependence coefficients.
Converts the copula parameters to Kendall's \(tau\).
Evaluates the copula density.
Evaluates a first derivative of the copula density.
Evaluates a second derivative of the copula density.
Generates a plot for the Bicop object.
Selects the best fitting model.
Simulates from a bivariate copula.
Converts a Kendall's \(\tau\)into copula parameters for one-parameter families.
Writes the copula object into a JSON or CBOR file.
Convert the copula into a nlohmann::json object.