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 |
newDataXJ |
this is a matrix of size |
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 |
Value
The function
treeCKT2matrixInd
returns a matrix of sizeN * m
which component[i,j]
is1\{ X_{i,J} \in A_{j,J} \}
.
The function
matrixInd2matrixCKT
andtreeCKT2matrixCKT
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)