Learn R Programming

VineCopula (version 2.6.0)

RVineMatrixCheck: R-Vine Matrix Check

Description

The given matrix is tested to be a valid R-vine matrix.

Usage

RVineMatrixCheck(M)

Value

code

1 for OK;
-4 matrix is neither lower nor upper triangular;
-3 diagonal can not be put in order d:1;
-2 for not permutation of j:d in column d-j;
-1 if cannot find proper binary array from array in natural order.

Arguments

M

A \(dxd\) vine matrix.

Author

Harry Joe

References

Joe H, Cooke RM and Kurowicka D (2011). Regular vines: generation algorithm and number of equivalence classes. In Dependence Modeling: Vine Copula Handbook, pp 219--231. World Scientific, Singapore.

See Also

RVineMatrix()

Examples

Run this code

A1 <- matrix(c(6, 0, 0, 0, 0, 0,
               5, 5, 0, 0, 0, 0,
               3, 4, 4, 0, 0, 0,
               4, 3, 3, 3, 0, 0,
               1, 1, 2, 2, 2, 0,
               2, 2, 1, 1, 1, 1), 6, 6, byrow = TRUE)
b1 <- RVineMatrixCheck(A1)
print(b1)
# improper vine matrix, code=-1
A2 <- matrix(c(6, 0, 0, 0, 0, 0,
               5, 5, 0, 0, 0, 0,
               4, 4, 4, 0, 0, 0,
               1, 3, 3, 3, 0, 0,
               3, 1, 2, 2, 2, 0,
               2, 2, 1, 1, 1,1 ), 6, 6, byrow = TRUE)
b2 <- RVineMatrixCheck(A2)
print(b2)
# improper vine matrix, code=-2
A3 <- matrix(c(6, 0, 0, 0, 0, 0,
               3, 5, 0, 0, 0, 0,
               3, 4, 4, 0, 0, 0,
               4, 3, 3, 3, 0, 0,
               1, 1, 2, 2, 2, 0,
               2, 2, 1, 1, 1, 1), 6, 6, byrow = TRUE)
b3 <- RVineMatrixCheck(A3)
print(b3)

Run the code above in your browser using DataLab