CKTmatrix.kernel {CondCopulas} | R Documentation |
Estimate the conditional Kendall's tau matrix at different conditioning points
Description
Assume that we are interested in a random vector (X, Z)
,
where X
is of dimension d > 2
and Z
is of dimension 1
.
We want to estimate the dependence across the elements of the conditioned vector X
given Z=z
.
This function takes in parameter observations of (X,Z)
and returns kernel-based estimators of
\tau_{i,j | Z=zk}
which is the conditional Kendall's tau between X_i
and X_j
given to Z=zk
, for every conditioning point zk
in gridZ
.
If the conditional Kendall's tau matrix has a block structure,
then improved estimation is possible by averaging over the kernel-based estimators of
pairwise conditional Kendall's taus.
Groups of variables composing the same blocks can be defined
using the parameter blockStructure
, and the averaging can be set on using
the parameter averaging=all
, or averaging=diag
for faster estimation by averaging only over diagonal elements of each block.
Usage
CKTmatrix.kernel(
dataMatrix,
observedZ,
gridZ,
averaging = "no",
blockStructure = NULL,
h,
kernel.name = "Epa",
typeEstCKT = "wdm"
)
Arguments
dataMatrix |
a matrix of size |
observedZ |
vector of observed points of a conditioning variable |
gridZ |
points at which the conditional Kendall's tau is computed. |
averaging |
type of averaging used for fast estimation. Possible choices are
|
blockStructure |
list of vectors.
Each vector corresponds to one group of variables
and contains the indexes of the variables that belongs to this group.
|
h |
bandwidth. It can be a real, in this case the same |
kernel.name |
name of the kernel used for smoothing.
Possible choices are: |
typeEstCKT |
type of estimation of the conditional Kendall's tau. |
Value
array with dimensions depending on averaging
:
If
averaging = "no"
: it returns an array of dimensions(n, n, length(gridZ))
, containing the estimated conditional Kendall's tau matrix givenZ = z
. Here,n
is the number of rows indataMatrix
.If
averaging = "all"
or"diag"
: it returns an array of dimensions(length(blockStructure), length(blockStructure), length(gridZ))
, containing the block estimates of the conditional Kendall's tau givenZ = z
with ones on the diagonal.
Author(s)
Rutger van der Spek, Alexis Derumigny
References
van der Spek, R., & Derumigny, A. (2022). Fast estimation of Kendall's Tau and conditional Kendall's Tau matrices under structural assumptions. arxiv:2204.03285.
See Also
CKT.kernel
for kernel-based estimation of conditional Kendall's tau
between two variables (i.e. the equivalent of this function
when X
is bivariate and d=2
).
Examples
# Data simulation
n = 100
Z = runif(n)
d = 5
CKT_11 = 0.8
CKT_22 = 0.9
CKT_12 = 0.1 + 0.5 * cos(pi * Z)
data_X = matrix(nrow = n, ncol = d)
for (i in 1:n){
CKT_matrix = matrix(data =
c( 1 , CKT_11 , CKT_11 , CKT_12[i], CKT_12[i] ,
CKT_11 , 1 , CKT_11 , CKT_12[i], CKT_12[i] ,
CKT_11 , CKT_11 , 1 , CKT_12[i], CKT_12[i] ,
CKT_12[i], CKT_12[i], CKT_12[i], 1 , CKT_22 ,
CKT_12[i], CKT_12[i], CKT_12[i], CKT_22 , 1
) ,
nrow = 5, ncol = 5)
sigma = sin(pi * CKT_matrix/2)
data_X[i, ] = mvtnorm::rmvnorm(n = 1, sigma = sigma)
}
plot(as.data.frame.matrix(data_X))
# Estimation of CKT matrix
h = 1.06 * sd(Z) * n^{-1/5}
gridZ = c(0.2, 0.8)
estMatrixAll <- CKTmatrix.kernel(
dataMatrix = data_X, observedZ = Z, gridZ = gridZ, h = h)
# Averaging estimator
estMatrixAve <- CKTmatrix.kernel(
dataMatrix = data_X, observedZ = Z, gridZ = gridZ,
averaging = "diag", blockStructure = list(1:3,4:5), h = h)
# The estimated CKT matrix conditionally to Z=0.2 is:
estMatrixAll[ , , 1]
# Using the averaging estimator,
# the estimated CKT between the first group (variables 1 to 3)
# and the second group (variables 4 and 5) is
estMatrixAve[1, 2, 1]
# True value (of CKT between variables in block 1 and 2 given Z = 0.2):
0.1 + 0.5 * cos(pi * 0.2)