conv_treeCKT {CondCopulas}R 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

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)


[Package CondCopulas version 0.1.3 Index]