vinecopulib::FitControlsVinecop class

A class for controlling fits of vine copula models.

Base classes

class FitControlsBicop
A class for controlling fits of bivariate copula models.

Constructors, destructors, conversion operators

FitControlsVinecop()
Instantiates default controls for fitting vine copula models.
FitControlsVinecop(std::vector<BicopFamily> family_set, std::string parametric_method = "mle", std::string nonparametric_method = "constant", double nonparametric_mult = 1.0, size_t nonparametric_grid_size = 30, size_t trunc_lvl = std::numeric_limits<size_t>::max(), std::string tree_criterion = "tau", double threshold = 0.0, std::string selection_criterion = "aic", const Eigen::VectorXd& weights = Eigen::VectorXd(), double psi0 = 0.9, bool preselect_families = true, bool select_trunc_lvl = false, bool select_threshold = false, bool select_families = true, bool show_trace = false, size_t num_threads = 1, std::string tree_algorithm = "mst_prim", bool allow_rotations = true, std::vector<int> seeds = std::vector<int>()) explicit
Instantiates custom controls for fitting vine copula models.
FitControlsVinecop(const FitControlsBicop& controls, size_t trunc_lvl = std::numeric_limits<size_t>::max(), std::string tree_criterion = "tau", double threshold = 0.0, bool select_trunc_lvl = false, bool select_threshold = false, bool select_families = true, bool show_trace = false, std::string tree_algorithm = "mst_prim", std::vector<int> seeds = std::vector<int>()) explicit
Instantiates custom controls for fitting vine copula models.
FitControlsVinecop(const FitControlsConfig& config) explicit
Instantiates the controls from a configuration object.

Public functions

auto str() const -> std::string
Summarizes the controls into a string (can be used for printing).

Getters and setters.

auto get_trunc_lvl() const -> size_t
Gets the truncation level.
auto get_tree_criterion() const -> std::string
Gets the criterion for tree selection.
auto get_threshold() const -> double
Gets the threshold parameter.
auto get_select_trunc_lvl() const -> bool
Gets whether to select the truncation level automatically.
auto get_select_threshold() const -> bool
Gets whether to select the threshold automatically.
auto get_select_families() const -> bool
Gets whether to select the families automatically.
auto needs_sparse_select() const -> bool
auto get_fit_controls_bicop() const -> FitControlsBicop
Gets the fit controls for bivariate fitting.
auto get_tree_algorithm() const -> std::string
Gets the maximum spanning tree algorithm.
auto get_seeds() const -> std::vector<int>
Gets the random seeds for the random number generator.
auto get_rng() const -> boost::random::mt19937
Gets the random number generator.
auto set_trunc_lvl(size_t trunc_lvl) -> void
Sets the truncation level.
auto set_tree_criterion(std::string tree_criterion) -> void
Sets the criterion for tree selection.
auto set_threshold(double threshold) -> void
Sets the threshold parameter.
auto set_select_trunc_lvl(bool select_trunc_lvl) -> void
Sets whether to select the truncation level automatically.
auto set_select_threshold(bool select_threshold) -> void
Sets whether to select the threshold automatically.
auto set_select_families(bool select_families) -> void
Sets whether to select the families automatically.
auto set_fit_controls_bicop(FitControlsBicop controls) -> void
Sets the fit controls for bivariate fitting.
auto set_tree_algorithm(std::string tree_algorithm) -> void
Sets the maximum spanning tree algorithm.
auto set_seeds(std::vector<int> seeds) -> void
Sets the random seeds for the random number generator.

Function documentation

vinecopulib::FitControlsVinecop::FitControlsVinecop(std::vector<BicopFamily> family_set, std::string parametric_method = "mle", std::string nonparametric_method = "constant", double nonparametric_mult = 1.0, size_t nonparametric_grid_size = 30, size_t trunc_lvl = std::numeric_limits<size_t>::max(), std::string tree_criterion = "tau", double threshold = 0.0, std::string selection_criterion = "aic", const Eigen::VectorXd& weights = Eigen::VectorXd(), double psi0 = 0.9, bool preselect_families = true, bool select_trunc_lvl = false, bool select_threshold = false, bool select_families = true, bool show_trace = false, size_t num_threads = 1, std::string tree_algorithm = "mst_prim", bool allow_rotations = true, std::vector<int> seeds = std::vector<int>()) explicit

Instantiates custom controls for fitting vine copula models.

Parameters
family_set The set of copula families to consider (if empty, then all families are included).
parametric_method The fit method for parametric families; possible choices: "mle", "itau".
nonparametric_method The fit method for the local-likelihood nonparametric family (TLLs); possible choices: "constant", "linear", "quadratic".
nonparametric_mult A factor with which the smoothing parameters are multiplied.
nonparametric_grid_size
trunc_lvl Truncation level for truncated vines.
tree_criterion The criterion for selecting the spanning tree ("tau", "hoeffd", "rho", and "mcor" implemented so far) during the tree-wise structure selection.
threshold For thresholded vines (0 = no threshold).
selection_criterion The selection criterion ("loglik", "aic", "bic", "mbic", or "mbicv") for the pair copula families.
weights A vector of weights for the observations.
psi0 Only for selection_criterion = "mbic", prior probability of non-independence.
preselect_families Whether to exclude families before fitting based on symmetry properties of the data.
select_trunc_lvl Whether the truncation shall be selected automatically.
select_threshold Whether the threshold parameter shall be selected automatically.
select_families Whether the families shall be selected automatically, or should the method simply update the parameters for the pair copulas already present in the model.
show_trace Whether to show a trace of the building progress.
num_threads Number of concurrent threads to use while fitting pair copulas within a tree; never uses more than the number of concurrent threads supported by the implementation.
tree_algorithm The algorithm for building the spanning tree ("mst_prim", "mst_kruskal", "random_weighted", or "random_unweighted") during the tree-wise structure selection. "mst_prim" and "mst_kruskal" use Prim's and Kruskal's algorithms respectively to select the maximum spanning tree, maximizing the sum of the edge weights (i.e., tree_criterion). "random_weighted" and "random_unweighted" use Wilson's algorithm to generate a random spanning tree, either with probability proportional to the product of the edge weights (weighted) or uniformly (unweighted).
allow_rotations Allow rotations for the families when doing model selection (default: true).
seeds A vector of random seeds for the random number generator for parts of the algorithm that are randomized (e.g., random tree selection).

vinecopulib::FitControlsVinecop::FitControlsVinecop(const FitControlsBicop& controls, size_t trunc_lvl = std::numeric_limits<size_t>::max(), std::string tree_criterion = "tau", double threshold = 0.0, bool select_trunc_lvl = false, bool select_threshold = false, bool select_families = true, bool show_trace = false, std::string tree_algorithm = "mst_prim", std::vector<int> seeds = std::vector<int>()) explicit

Instantiates custom controls for fitting vine copula models.

Parameters
controls See FitControlsBicop().
trunc_lvl Truncation level for truncated vines.
tree_criterion The criterion for selecting the spanning tree ("tau", "hoeffd", "rho", and "mcor" implemented so far) during the tree-wise structure selection.
threshold For thresholded vines (0 = no threshold).
select_trunc_lvl Whether the truncation shall be selected automatically.
select_threshold Whether the threshold parameter shall be selected automatically.
select_families Whether the families shall be selected automatically, or should the method simply update the parameters for the pair copulas already present in the model.
show_trace Whether to show a trace of the building progress.
tree_algorithm The algorithm for building the spanning tree ("mst_prim", "mst_kruskal", "random_weighted", or "random_unweighted") during the tree-wise structure selection. "mst_prim" and "mst_kruskal" use Prim's and Kruskal's algorithms respectively to select the maximum spanning tree, maximizing the sum of the edge weights (i.e., tree_criterion). "random_weighted" and "random_unweighted" use Wilson's algorithm to generate a random spanning tree, either with probability proportional to the product of the edge weights (weighted) or uniformly (unweighted).
seeds A vector of random seeds for the random number generator for parts of the algorithm that are randomized (e.g., random tree selection).

vinecopulib::FitControlsVinecop::FitControlsVinecop(const FitControlsConfig& config) explicit

Instantiates the controls from a configuration object.

Parameters
config The configuration object.

size_t vinecopulib::FitControlsVinecop::get_trunc_lvl() const

Gets the truncation level.

Returns the truncation level (the number of trees that will be fit; pair copulas above this level are forced to independence).

std::string vinecopulib::FitControlsVinecop::get_tree_criterion() const

Gets the criterion for tree selection.

Returns the edge-weighting criterion used to grow the structure (one of "tau", "rho", "hoeffd", "mcor").

double vinecopulib::FitControlsVinecop::get_threshold() const

Gets the threshold parameter.

Returns the absolute-dependence threshold below which pair copulas are set to independence during structure selection (0 disables).

bool vinecopulib::FitControlsVinecop::get_select_trunc_lvl() const

Gets whether to select the truncation level automatically.

Returns whether the truncation level is selected automatically via the mBICv criterion during fitting.

bool vinecopulib::FitControlsVinecop::get_select_threshold() const

Gets whether to select the threshold automatically.

Returns whether the threshold is selected automatically during fitting.

bool vinecopulib::FitControlsVinecop::get_select_families() const

Gets whether to select the families automatically.

Returns whether pair-copula families are selected during fitting (when false, pre-specified families are used).

bool vinecopulib::FitControlsVinecop::needs_sparse_select() const

Returns whether sparse selection (truncation or thresholding) is enabled in the current configuration.

FitControlsBicop vinecopulib::FitControlsVinecop::get_fit_controls_bicop() const

Gets the fit controls for bivariate fitting.

Returns the bicop fit controls used for each pair-copula fit.

std::string vinecopulib::FitControlsVinecop::get_tree_algorithm() const

Gets the maximum spanning tree algorithm.

Returns the structure-selection algorithm (one of "mst_prim" for Dissmann's greedy heuristic or "random_weighted" for Wilson-weighted random spanning trees).

std::vector<int> vinecopulib::FitControlsVinecop::get_seeds() const

Gets the random seeds for the random number generator.

Returns the random seeds used by the structure-selection RNG (empty to use a non-reproducible seed).