Vinecop
- class Vinecop(*args, **kwargs)
A class for vine copula models.
A vine copula model is characterized by its structure (see
RVineStructureobjects) and the pair-copulas (seeBicopobjects).- Attributes:
dimReturns ——- int the dimension of the vine (number of variables).
familiesReturns ——- list of list of BicopFamily the families of all pair copulas, indexed as
[tree][edge].matrixReturns ——- ndarray, shape (n, m), dtype int the R-vine structure as a square matrix (cf.
nobsReturns ——- int the number of observations used to fit the vine (
0untilfit()has been called).nparsReturns ——- float the total number of parameters across all pair copulas.
orderReturns ——- list of int the natural variable order in the first tree.
pair_copulasReturns ——- list of list of Bicop all pair copulas, indexed as
[tree][edge].parametersReturns ——- list of list of ndarray, shape (n, m), dtype float the parameter matrices of all pair copulas, indexed as
[tree][edge].rotationsReturns ——- list of list of int the rotations of all pair copulas, indexed as
[tree][edge].structureReturns ——- RVineStructure the underlying R-vine structure.
tausReturns ——- list of list of float Kendall’s tau for every pair copula, indexed as
[tree][edge].thresholdReturns ——- float the absolute-dependence threshold used during structure selection (
0if thresholding was disabled).trunc_lvlReturns ——- int the truncation level (number of fitted trees; pair copulas in trees above this level are forced to independence).
var_typesReturns ——- list of str the variable types of each variable (each
"c"for continuous or"d"for discrete).
Methods
aic(self[, u, num_threads])Evaluates the Akaike information criterion (AIC).
bic(self[, u, num_threads])Evaluates the Bayesian information criterion (BIC).
cdf(self, u[, N, num_threads, seeds])Evaluates the copula distribution.
fit(self, data[, controls, num_threads])Fits the parameters of a pre-specified vine copula model.
format(self[, trees])Summarizes the model into a string (can be used for printing).
from_data(data[, structure, matrix, ...])Factory function to create a Vinecop from data.
Instantiates a D-vine with all pair-copulas set to independence.
from_file(filename[, check])Instantiates from a JSON or CBOR file.
from_json(json[, check])Instantiates from a nlohmann::json object.
from_structure([structure, matrix, ...])Factory function to create a Vinecop using either a structure or a matrix.
get_family(self, tree, edge)Gets the family of the pair copula at the given (tree, edge).
get_pair_copula(self, tree, edge)Gets the pair copula at the given (tree, edge) position.
get_parameters(self, tree, edge)Gets the parameter matrix of the pair copula at the given (tree, edge).
get_rotation(self, tree, edge)Gets the rotation (degrees) of the pair copula at the given (tree, edge).
get_struct_array(self[, natural_order])- Parameters:
get_tau(self, tree, edge)Gets Kendall's tau of the pair copula at the given (tree, edge).
gradient(self, u[, step_wise, num_threads])Evaluates the gradient of the average log-likelihood.
hessian(self, u[, step_wise, num_threads])Evaluates the averaged Hessian of the log-likelihood.
hessian_full(self, u[, step_wise, num_threads])Evaluates the hessian per observation.
inverse_rosenblatt(self, u[, num_threads])Evaluates the inverse Rosenblatt transform.
loglik(self[, u, num_threads])Evaluates the log-likelihood.
mbicv(self[, u, psi0, num_threads])Evaluates the modified Bayesian information criterion for vines (mBICV).
pdf(self, u[, num_threads])Evaluates the copula density.
pdf_full(self, u[, num_threads, keep_all])Evaluates the vine copula density and, optionally, the per-edge densities and h-functions.
plot(self[, tree, add_edge_labels, layout, ...])Generates a plot for the Vinecop object.
rosenblatt(self, u[, num_threads, ...])Evaluates the Rosenblatt transform for a vine copula model.
scores(self, u[, step_wise, num_threads])Evaluates the score function.
scores_cov(self, u[, step_wise, num_threads])Computes the covariance matrix of scores.
scores_full(self, u[, step_wise, ...])Evaluates the score function together with the per-edge derivative caches.
select(self, data[, controls])In other words,
select()behaves differently depending on its current truncation level and the truncation level specified in the controls, respectively calledtrunc_lvlandcontrols.trunc_lvlin what follows.simulate(self, n[, qrng, num_threads, seeds])Simulates from a vine copula model, see
inverse_rosenblatt().to_file(self, filename)Writes the copula object into a JSON or CBOR file.
to_json(self)Converts the copula into a nlohmann::json object.
truncate(self, trunc_lvl)Truncates the vine copula model.
Attributes
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
- Returns:
Methods
Default constructor for the
Vinecopclass.Evaluates the Akaike information criterion (AIC).
Evaluates the Bayesian information criterion (BIC).
Evaluates the copula distribution.
Fits the parameters of a pre-specified vine copula model.
Summarizes the model into a string (can be used for printing).
Factory function to create a Vinecop from data.
Instantiates a D-vine with all pair-copulas set to independence.
Instantiates from a JSON or CBOR file.
Instantiates from a nlohmann::json object.
Factory function to create a Vinecop using either a structure or a matrix.
Gets the family of the pair copula at the given (tree, edge).
Gets the pair copula at the given (tree, edge) position.
Gets the parameter matrix of the pair copula at the given (tree, edge).
Gets the rotation (degrees) of the pair copula at the given (tree, edge).
- Parameters:
Gets Kendall's tau of the pair copula at the given (tree, edge).
Evaluates the gradient of the average log-likelihood.
Evaluates the averaged Hessian of the log-likelihood.
Evaluates the hessian per observation.
Evaluates the inverse Rosenblatt transform.
Evaluates the log-likelihood.
Evaluates the modified Bayesian information criterion for vines (mBICV).
Evaluates the copula density.
Evaluates the vine copula density and, optionally, the per-edge densities and h-functions.
Generates a plot for the Vinecop object.
Evaluates the Rosenblatt transform for a vine copula model.
Evaluates the score function.
Computes the covariance matrix of scores.
Evaluates the score function together with the per-edge derivative caches.
In other words,
select()behaves differently depending on its current truncation level and the truncation level specified in the controls, respectively calledtrunc_lvlandcontrols.trunc_lvlin what follows.Simulates from a vine copula model, see
inverse_rosenblatt().Writes the copula object into a JSON or CBOR file.
Converts the copula into a nlohmann::json object.
Truncates the vine copula model.