reformcopmat: Rearrange the Matrices following Rearrangement of Vine Array

Description Usage Arguments Value Note Examples

View source: R/reformcopmat.R

Description

If you changed the order of your vine array, this function will convert other matrices associated with the original vine array (such as copula matrix or copula parameter matrix) into new matrices associated with the new vine array.

Usage

1
reformcopmat(mat, Gnew, Gold)

Arguments

mat

Old matrix to rearrange, such as a copula matrix or copula parameter matrix. Should be upper-triangular, with nrows = truncation number, ncols = vine dimension.

Anew

The new vine array index, possibly truncated. Could have less variables and more truncation than Aold.

Aold

The old vine array index, possibly truncated.

Value

A matrix that's possibly subsetted and/or rearranged from mat.

Note

Make sure that the variables in Aold and Anew have the same labels.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Originally...
G <- AtoG(Cvinearray(4))[1:3, ]
copmat <- makeuppertri(c("gum", "gal", "bvtcop",
                         "bvncop", "frk"), row = 2, col = 4, blanks = "")
cparmat <- makeuppertri.list(c(2, 3, 0.9, 4, 0.1, 0.5),
                             len = c(1,1,2,1,1), row = 2, col = 4)

## Obtain new vine array by some means:
Gnew <- centervarray(G)
## Get new matrices:
reformcopmat(copmat, Gnew, G)
reformcopmat(cparmat, Gnew, G)

## Try changing the dimension of G
Gnew <- subsetvarray(G[1:2, ], 1:3)
reformcopmat(copmat, Gnew, G)
reformcopmat(cparmat, Gnew, G)

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