Vinecop

class Vinecop(*args, **kwargs)

A class for vine copula models.

A vine copula model is characterized by its structure (see RVineStructure objects) and the pair-copulas (see Bicop objects).

Attributes:
dim

Returns ——- int the dimension of the vine (number of variables).

families

Returns ——- list of list of BicopFamily the families of all pair copulas, indexed as [tree][edge].

matrix

Returns ——- ndarray, shape (n, m), dtype int the R-vine structure as a square matrix (cf.

nobs

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

npars

Returns ——- float the total number of parameters across all pair copulas.

order

Returns ——- list of int the natural variable order in the first tree.

pair_copulas

Returns ——- list of list of Bicop all pair copulas, indexed as [tree][edge].

parameters

Returns ——- list of list of ndarray, shape (n, m), dtype float the parameter matrices of all pair copulas, indexed as [tree][edge].

rotations

Returns ——- list of list of int the rotations of all pair copulas, indexed as [tree][edge].

structure

Returns ——- RVineStructure the underlying R-vine structure.

taus

Returns ——- list of list of float Kendall’s tau for every pair copula, indexed as [tree][edge].

threshold

Returns ——- float the absolute-dependence threshold used during structure selection (0 if thresholding was disabled).

trunc_lvl

Returns ——- int the truncation level (number of fitted trees; pair copulas in trees above this level are forced to independence).

var_types

Returns ——- 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.

from_dimension(d)

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 called trunc_lvl and controls.trunc_lvl in 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

dim

Returns:

families

Returns:

matrix

Returns:

nobs

Returns:

npars

Returns:

order

Returns:

pair_copulas

Returns:

parameters

Returns:

rotations

Returns:

structure

Returns:

taus

Returns:

threshold

Returns:

trunc_lvl

Returns:

var_types

Returns:

Methods

__init__

Default constructor for the Vinecop class.

aic

Evaluates the Akaike information criterion (AIC).

bic

Evaluates the Bayesian information criterion (BIC).

cdf

Evaluates the copula distribution.

fit

Fits the parameters of a pre-specified vine copula model.

format

Summarizes the model into a string (can be used for printing).

from_data

Factory function to create a Vinecop from data.

from_dimension

Instantiates a D-vine with all pair-copulas set to independence.

from_file

Instantiates from a JSON or CBOR file.

from_json

Instantiates from a nlohmann::json object.

from_structure

Factory function to create a Vinecop using either a structure or a matrix.

get_family

Gets the family of the pair copula at the given (tree, edge).

get_pair_copula

Gets the pair copula at the given (tree, edge) position.

get_parameters

Gets the parameter matrix of the pair copula at the given (tree, edge).

get_rotation

Gets the rotation (degrees) of the pair copula at the given (tree, edge).

get_struct_array

Parameters:

get_tau

Gets Kendall's tau of the pair copula at the given (tree, edge).

gradient

Evaluates the gradient of the average log-likelihood.

hessian

Evaluates the averaged Hessian of the log-likelihood.

hessian_full

Evaluates the hessian per observation.

inverse_rosenblatt

Evaluates the inverse Rosenblatt transform.

loglik

Evaluates the log-likelihood.

mbicv

Evaluates the modified Bayesian information criterion for vines (mBICV).

pdf

Evaluates the copula density.

pdf_full

Evaluates the vine copula density and, optionally, the per-edge densities and h-functions.

plot

Generates a plot for the Vinecop object.

rosenblatt

Evaluates the Rosenblatt transform for a vine copula model.

scores

Evaluates the score function.

scores_cov

Computes the covariance matrix of scores.

scores_full

Evaluates the score function together with the per-edge derivative caches.

select

In other words, select() behaves differently depending on its current truncation level and the truncation level specified in the controls, respectively called trunc_lvl and controls.trunc_lvl in what follows.

simulate

Simulates from a vine copula model, see inverse_rosenblatt().

to_file

Writes the copula object into a JSON or CBOR file.

to_json

Converts the copula into a nlohmann::json object.

truncate

Truncates the vine copula model.