datasetPairs: Construct a dataset of pairs of observations for the...

View source: R/estimationCKT.datasetPairs.R

datasetPairsR Documentation

Construct a dataset of pairs of observations for the estimation of conditional Kendall's tau

Description

In (Derumigny, & Fermanian (2019)), it is described how the problem of estimating conditional Kendall's tau can be rewritten as a classification task for a dataset of pairs (of observations). This function computes such a dataset, that can be then used to estimate conditional Kendall's tau using one of the following functions: CKT.fit.tree, CKT.fit.randomForest, CKT.fit.GLM, CKT.fit.nNets, CKT.predict.kNN.

Usage

datasetPairs(
  X1,
  X2,
  Z,
  h,
  cut = 0.9,
  onlyConsecutivePairs = FALSE,
  nPairs = NULL
)

Arguments

X1

vector of observations of the first conditioned variable.

X2

vector of observations of the second conditioned variable.

Z

vector or matrix of observations of the conditioning variable(s), of dimension dimZ.

h

the bandwidth. Can be a vector; in this case, the components of h will be reused to match the dimension of Z.

cut

the cutting level to keep a given pair or not. Used only if no nPairs is provided.

onlyConsecutivePairs

if TRUE, only consecutive pairs are used.

nPairs

number of most relevant pairs to keep in the final datasets. If this is different than the default NULL, the cutting level cut is not used.

Value

A matrix with (4+dimZ) columns and n*(n-1)/2 rows if onlyConsecutivePairs=FALSE and else (n/2) rows. It is structured in the following way:

  • column 1 contains the information about the concordance of the pair (i,j) ;

  • columns 2 to 1+dimZ contain the mean value of Z (the conditioning variables) ;

  • column 2+dimZ contains the value of the kernel K_h(Z_j - Z_i) ;

  • column 3+dimZ and 4+dimZ contain the corresponding values of i and j.

References

Derumigny, A., & Fermanian, J. D. (2019). A classification point-of-view about conditional Kendall’s tau. Computational Statistics & Data Analysis, 135, 70-94. (Algorithm 1 for all pairs and Algorithm 8 for the case of only consecutive pairs) \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.csda.2019.01.013")}

See Also

the functions that require such a dataset of pairs to do the estimation of conditional Kendall's tau: CKT.fit.tree, CKT.fit.randomForest, CKT.fit.GLM, CKT.fit.nNets, CKT.predict.kNN, and CKT.fit.randomForest.

Examples

# We simulate from a conditional copula
N = 500
Z = rnorm(n = N, mean = 5, sd = 2)
conditionalTau = 0.9 * pnorm(Z, mean = 5, sd = 2)
simCopula = VineCopula::BiCopSim(N = N , family = 3,
    par = VineCopula::BiCopTau2Par(1 , conditionalTau) )
X1 = qnorm(simCopula[,1])
X2 = qnorm(simCopula[,2])

datasetP = datasetPairs(
X1 = X1, X2 = X2, Z = Z, h = 0.07, cut = 0.9)


CondCopulas documentation built on Sept. 11, 2024, 9:10 p.m.