conv_treeCKT: Converting to matrix of indicators / matrix of conditional...

conv_treeCKTR Documentation

Converting to matrix of indicators / matrix of conditional Kendall's tau

Description

The function treeCKT2matrixInd takes as input a binary tree that has been returned by the function bCond.treeCKT. Since this tree describes a partition of the conditioning space, it can be interesting to get, for a given dataset, the matrix

1\{ X_{i,J} \in A_{j,J} \},

where each A_{j,J} corresponds to a conditioning subset. This is the so-called matrixInd. Finally, it can be interesting to get the matrix of

Usage

treeCKT2matrixInd(estimatedTree, newDataXJ = NULL)

matrixInd2matrixCKT(matrixInd, newDataXI)

treeCKT2matrixCKT(estimatedTree, newDataXI = NULL, newDataXJ = NULL)

Arguments

estimatedTree

the tree that has been estimated before, for example by bCond.treeCKT.

newDataXJ

this is a matrix of size N * |J| where |J| is the number of conditional variables used in the tree. By default this is NULL meaning that we return the matrix for the original data (that was used to compute the estimatedTree).

matrixInd

a matrix of indexes of size (n, N.boxes) describing for each observation i to which box ( = event) it belongs.

newDataXI

this is a matrix of size N * |I| where |I| is the number of conditioned variables. By default this is NULL meaning that we return the matrix for the original data used to compute the estimatedTree

Value

  • The function treeCKT2matrixInd returns a matrix of size N * m which component [i,j] is

    1\{ X_{i,J} \in A_{j,J} \}

    .

  • The function matrixInd2matrixCKT and treeCKT2matrixCKT return a matrix of size |I| * (|I|-1) * m where each component corresponds to a conditional Kendall's tau between a pair of conditional variables conditionally to the conditioned variables in one of the boxes

See Also

bCond.treeCKT for the construction of such a binary tree.

Examples

set.seed(1)
n = 200
XJ = MASS::mvrnorm(n = n, mu = c(3,3), Sigma = rbind(c(1, 0.2), c(0.2, 1)))
XI = matrix(nrow = n, ncol = 2)
high_XJ1 = which(XJ[,1] > 4)
XI[high_XJ1, ]  = MASS::mvrnorm(n = length(high_XJ1), mu = c(10,10),
                                Sigma = rbind(c(1, 0.8), c(0.8, 1)))
XI[-high_XJ1, ] = MASS::mvrnorm(n = n - length(high_XJ1), mu = c(8,8),
                                Sigma = rbind(c(1, -0.2), c(-0.2, 1)))

result = bCond.treeCKT(XI = XI, XJ = XJ, minSize = 10, verbose = 2)

treeCKT2matrixInd(result)

matrixInd2matrixCKT(treeCKT2matrixInd(result), newDataXI = XI)

treeCKT2matrixCKT(result)


CondCopulas documentation built on Sept. 11, 2024, 9:10 p.m.