center: Center a Vine

Description Usage Arguments Details Value Examples

View source: R/center.rvine.R

Description

Converts a vine array (centervarray) or vine (center.rvine) so that the first variables (up to truncation) are not "leaves". This may not work outside of regular vines with truncation under the traditional sense.

Usage

1
2
3
4
centervarray(G)

## S3 method for class 'rvine'
center(rv)

Arguments

G

Vine array. Must be a regular vine, with truncation in the traditional sense.

rv

Regular vine object.

Details

For a t-truncated vine array (t < ncol(G)-1), the vine array is re-ordered so that the first t variables introduced in the outputted array are not leaves.

If t = ncol(G)-1, then the entered vine isn't truncated, and the first t-1 variables in the outputted array are not leaves (in fact, a natural order array is outputted, since it satisfies that requirement).

Value

G-vine array or vine, with variables reordered.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Setup a vine.
G <- AtoG(CopulaModel::Dvinearray(5))
copmat <- makeuppertri(c("gum", "mtcj", "gal", "joe",
                         "frk", "gum", "bb7",
                         "bb1", "indepcop",
                         "bb8"), 4, 5, "")
cparmat <- makeuppertri.list(c(3, 2.5, 2, 1.5,
                               1, 1.3, 2, 2,
                               3, 4,
                               5, 0.5),
                             len = c(1,1,1,1,1,1,2,2,0,2),
                             4, 5)
(rv <- rvine(G, copmat, cparmat))

## Center it. Since it's a complete vine, the output is in natural order:
centervarray(G)
center(rv)

## Center a truncated vine:
centervarray(G[1:3, ])
center(trunc(rv, 2))

## It works in these cases too:
center(trunc(rv, 0))
center(subset(rv, 5))
center(subset(rv, integer(0)))

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