fitrvine: Fit a Vine Model

Description Usage Arguments Details Value Examples

View source: R/fitrvine.R

Description

Fits a joint distribution for the data using a vine copula. The vine array is first chosen using the minimum spanning tree algorithm using the function gausstrvine.mst in the CopulaModel package, then the pairwise copula models are chosen and fit using RVineCopSelect in the VineCopula package.

Usage

1
fitrvine(dat, layer = layeropts(1:ncol(dat)), basevine = NULL, ...)

Arguments

dat

Matrix of data having Uniform marginal distributions; columns represent variables, and rows observations.

...

Other arguments to pass to VineCopula::RVineCopSelect.

rv

Object of class "rvine", representing a pre-specification of the vine to fit. Or, NULL for fully unspecified. See details.

var

Vector of integers specifying the column numbers of dat to fit a model to. Default is all variables.

ntrunc

Integer, either 1, 2, ...,ncol(dat)-1, of the truncation level of the vine to be fit.

families

A vector of copula family names to try fitting (will also consider their rotations/reflections). Limited to those families available in VineCopula package, listed in BiCopSelect.

Details

If you want to specify parts of the vine, then specify them in an "rvine" object (see rvine):

  1. Your first option is to specify the vine array A.

  2. If the vine array is specified, then you can specify some or all of the copula families by putting them in copmat. Leave unspecified edges as NA.

  3. If there are copula families specified, you can specify parameters for those families by putting the parameters in cparmat. Unspecified parameters should be NA.

For parts of the vine that are unspecified, you have some fitting options:

Value

A "fitrvine" object, which has class c("fitrvine", "rvine"), which is a named list of the following:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Get some simulated data:
set.seed(152)
ntrunc <- 2
d <- 4
A0 <- truncvarray(CopulaModel::Dvinearray(d), ntrunc)
copmat0 <- makeuppertri("frk", ntrunc, d, "")
cparmat0 <- makeuppertri(3, ntrunc, d)
dat <- fvinesim(100, A0, copmat0, cparmat0)

## Fit a model to the data:
fit.rvine(dat, ntrunc=ntrunc)
fit.rvine(dat, c(4, 2, 3))

vincenzocoia/copsupp documentation built on Aug. 23, 2020, 7:37 a.m.