CKT.estimate | R Documentation |
Let X_1
and X_2
be two random variables.
The goal of this function is to estimate the conditional Kendall's tau
(a dependence measure) between X_1
and X_2
given Z=z
for a conditioning variable Z
.
Conditional Kendall's tau between X_1
and X_2
given Z=z
is defined as:
P( (X_{1,1} - X_{2,1})(X_{1,2} - X_{2,2}) > 0 | Z_1 = Z_2 = z)
- P( (X_{1,1} - X_{2,1})(X_{1,2} - X_{2,2}) < 0 | Z_1 = Z_2 = z),
where (X_{1,1}, X_{1,2}, Z_1)
and (X_{2,1}, X_{2,2}, Z_2)
are two independent and identically distributed copies of (X_1, X_2, Z)
.
In other words, conditional Kendall's tau is the difference
between the probabilities of observing concordant and discordant pairs
from the conditional law of
(X_1, X_2) | Z=z.
This function can use different estimators for conditional Kendall's tau,
see the description of the parameter methodEstimation
for a complete list of possibilities.
CKT.estimate(
X1 = NULL, X2 = NULL, Z = NULL,
newZ = Z, methodEstimation, h,
listPhi = if(methodEstimation == "kendallReg")
{list( function(x){return(x)} ,
function(x){return(x^2)} ,
function(x){return(x^3)} )
} else {list(identity)} ,
... ,
observedX1 = NULL, observedX2 = NULL, observedZ = NULL )
X1 |
a vector of |
X2 |
a vector of |
Z |
a vector of |
newZ |
the new values for the conditioning variable
|
methodEstimation |
method for estimating the conditional Kendall's tau. Possible estimation methods are:
|
h |
the bandwidth |
listPhi |
the list of transformations to be applied
to the conditioning variable |
... |
other parameters passed to the estimating functions
|
observedX1 , observedX2 , observedZ |
old parameter names for |
the vector of estimated conditional Kendall's tau
at each of the observations of newZ
.
Derumigny, A., & Fermanian, J. D. (2019a). A classification point-of-view about conditional Kendall’s tau. Computational Statistics & Data Analysis, 135, 70-94. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2019.01.013")}
Derumigny, A., & Fermanian, J. D. (2019b). On kernel-based estimation of conditional Kendall’s tau: finite-distance bounds and asymptotic behavior. Dependence Modeling, 7(1), 292-321. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1515/demo-2019-0016")}
Derumigny, A., & Fermanian, J. D. (2020). On Kendall’s regression. Journal of Multivariate Analysis, 178, 104610. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jmva.2020.104610")}
the specialized functions for estimating
conditional Kendall's tau for each method:
CKT.fit.tree
, CKT.fit.randomForest
,
CKT.fit.GLM
, CKT.fit.nNets
,
CKT.predict.kNN
, CKT.fit.randomForest
,
CKT.kernel
and CKT.kendallReg.fit
.
See also the nonparametric estimator of conditional copula models
estimateNPCondCopula
,
and the parametric estimators of conditional copula models
estimateParCondCopula
.
In the case where Z
is discrete
or in the case of discrete conditioning events, see
bCond.treeCKT
.
# We simulate from a conditional copula
set.seed(1)
N = 300
Z = rnorm(n = N, mean = 5, sd = 2)
conditionalTau = -0.9 + 1.8 * pnorm(Z, mean = 5, sd = 2)
simCopula = VineCopula::BiCopSim(N=N , family = 1,
par = VineCopula::BiCopTau2Par(1 , conditionalTau ))
X1 = qnorm(simCopula[,1])
X2 = qnorm(simCopula[,2])
newZ = seq(2,10,by = 0.1)
h = 0.1
estimatedCKT_tree <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "tree", h = h)
estimatedCKT_rf <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "randomForest", h = h)
estimatedCKT_GLM <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "logit", h = h,
listPhi = list(function(x){return(x)}, function(x){return(x^2)},
function(x){return(x^3)}) )
estimatedCKT_kNN <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "nearestNeighbors", h = h,
number_nn = c(50,80, 100, 120,200),
partition = 4
)
estimatedCKT_nNet <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "neuralNetwork", h = h,
)
estimatedCKT_kernel <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "kernel", h = h,
)
estimatedCKT_kendallReg <- CKT.estimate(
X1 = X1, X2 = X2, Z = Z,
newZ = newZ,
methodEstimation = "kendallReg", h = h)
# Comparison between true Kendall's tau (in black)
# and estimated Kendall's tau (in other colors)
trueConditionalTau = -0.9 + 1.8 * pnorm(newZ, mean = 5, sd = 2)
plot(newZ, trueConditionalTau , col="black",
type = "l", ylim = c(-1, 1))
lines(newZ, estimatedCKT_tree, col = "red")
lines(newZ, estimatedCKT_rf, col = "blue")
lines(newZ, estimatedCKT_GLM, col = "green")
lines(newZ, estimatedCKT_kNN, col = "purple")
lines(newZ, estimatedCKT_nNet, col = "coral")
lines(newZ, estimatedCKT_kernel, col = "skyblue")
lines(newZ, estimatedCKT_kendallReg, col = "darkgreen")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.