View source: R/bCond.treeCKT.R
bCond.treeCKT | R Documentation |
This function takes in parameter two matrices of observations:
the first one contains the observations of XI
(the conditioned variables)
and the second on contains the observations of XJ
(the conditioning variables).
The goal of this procedure is to find which of the variables in XJ
have important influence on the dependence between the components of XI
,
(measured by the Kendall's tau).
bCond.treeCKT(
XI,
XJ,
minCut = 0,
minProb = 0.01,
minSize = minProb * nrow(XI),
nPoints_xJ = 10,
type.quantile = 7,
verbose = 2
)
XI |
matrix of size n*p of observations of the conditioned variables. |
XJ |
matrix of size n*(d-p) containing observations of the conditioning vector. |
minCut |
minimum difference in probabilities that is necessary to cut. |
minProb |
minimum probability of being in one of the node. |
minSize |
minimum number of observations in each node. This is an alternative to minProb and has priority over it. |
nPoints_xJ |
number of points in the grid that are considered when choosing the point for splitting the tree. |
type.quantile |
way of computing the quantiles,
see |
verbose |
control the text output of the procedure.
If |
The object return by this function is a binary tree. Each leaf of this tree
correspond to one event (or, equivalently, one subset of R^{dim(XJ)}
),
and the conditional Kendall's tau conditionally to it.
the estimated tree using the data 'XI, XJ'.
Derumigny, A., Fermanian, J. D., & Min, A. (2022). Testing for equality between conditional copulas given discretized conditioning events. Canadian Journal of Statistics. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/cjs.11742")}
bCond.simpA.CKT
for a test of the simplifying assumption
that all these conditional Kendall's tau are equal.
treeCKT2matrixInd
for converting this tree to a matrix of indicators
of each event. matrixInd2matrixCKT
for getting the matrix of estimated
conditional Kendall's taus for each event.
CKT.estimate
for the estimation of
pointwise conditional Kendall's tau,
i.e. assuming a continuous conditioning variable Z
.
set.seed(1)
n = 400
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 = 50, verbose = 2)
# Plotting the corresponding tree using the "DiagrammeR" package
if (requireNamespace("DiagrammeR", quietly = TRUE)){
plot(result)
}
# Number of observations in the first two children
print(length(data.tree::GetAttribute(result$children[[1]], "condObs")))
print(length(data.tree::GetAttribute(result$children[[2]], "condObs")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.