Learn R Programming

rvinecopulib (version 0.2.8.1.0)

vine: Vine copula models

Description

Automated fitting or creation of custom vine copula models

Usage

vine(data, margins_controls = list(mult = NULL, xmin = NaN, xmax = NaN, bw =
  NA), copula_controls = list(family_set = "all", matrix = NA, par_method =
  "mle", nonpar_method = "constant", mult = 1, selcrit = "bic", psi0 = 0.9,
  presel = TRUE, trunc_lvl = Inf, tree_crit = "tau", threshold = 0, keep_data =
  TRUE, show_trace = FALSE, cores = 1))

vine_dist(margins, pair_copulas, matrix)

Arguments

data

a matrix or data.frame.

margins_controls

a list with arguments to be passed to kde1d::kde1d(). Currently, there can be

  • mult numeric; all bandwidths for marginal kernel density estimation are multiplied with mult_1d. Defaults to log(1 + d) where d is the number of variables after applying cctools::expand_as_numeric().

  • xmin numeric vector of length d; see kde1d::kde1d().

  • xmax numeric vector of length d; see kde1d::kde1d().

  • bw numeric vector of length d; see kde1d::kde1d().

copula_controls

a list with arguments to be passed to vinecop().

margins

A list with with each element containing the specification of a marginal stats::Distributions. Each marginal specification should be a list with containing at least the name and optionally the parameters, e.g. list(list(name = "norm"), list(name = "norm", mu = 1), list(name = "beta", shape1 = 1, shape2 = 1)). Note that parameters that have no default values have to be provided. Furthermore, if margins has length one, it will be recycled for every component.

pair_copulas

A nested list of 'bicop_dist' objects, where pair_copulas[[t]][[e]] corresponds to the pair-copula at edge e in tree t.

matrix

a quadratic matrix specifying the structure matrix (see check_rvine_matrix()); for vinecop_dist(), the dimension must be length(pair_copulas)-1; for vinecop(), matrix = NA performs automatic structure selection.

Value

Objects inheriting from vine_dist for vine_dist(), and vine and vine_dist for vine().

Objects from the vine_dist class are lists containing:

  • margins, a list of marginals (see below).

  • copula, an object of the class vinecop_dist, see vinecop_dist().

For objects from the vine class, copula is also an object of the class vine, see vinecop(). Additionally, objects from the vine class contain:

  • margins_controls, a list with the set of fit controls that was passed to kde1d::kde1d() when estimating the margins.

  • copula_controls, a list with the set of fit controls that was passed to vinecop() when estimating the copula.

  • data (optionally, if keep_data = TRUE was used), the dataset that was passed to vinecop().

  • nobs, an integer containing the number of observations that was used to fit the model.

Concerning margins:

  • For objects created with vine_dist(), it simply corresponds to the margins argument.

  • For objects created with vine(), it is a list of objects of class kde1d, see kde1d::kde1d().

Details

vine_dist() creates a vine copula by specifying the margins, a nested list of bicop_dist objects and a quadratic structure matrix.

vine() provides automated fitting for vine copula models. margins_controls is a list with the same parameters as kde1d::kde1d() (except for x). copula_controls is a list with the same parameters as vinecop() (except for data).

Examples

Run this code
# NOT RUN {
# specify pair-copulas
bicop <- bicop_dist("bb1", 90, c(3, 2))
pcs <- list(
    list(bicop, bicop),  # pair-copulas in first tree 
    list(bicop)          # pair-copulas in second tree 
 )
 
# specify R-vine matrix
mat <- matrix(c(1, 2, 3, 1, 2, 0, 1, 0, 0), 3, 3) 

# set up vine copula model with Gaussian margins
vc <- vine_dist(list(name = "norm"), pcs, mat)

# show model
summary(vc)

# simulate some data
x <- rvine(50, vc)

# estimate a vine copula model
fit <- vine(x, copula_controls = list(family_set = "par"))
summary(fit)

# }

Run the code above in your browser using DataLab