KPCRKHS | R Documentation |
Compute estimate of Kernel partial correlation (KPC) coefficient using conditional mean embeddings in the reproducing kernel Hilbert spaces (RKHS).
KPCRKHS( Y, X = NULL, Z, ky = kernlab::rbfdot(1/(2 * stats::median(stats::dist(Y))^2)), kx = kernlab::rbfdot(1/(2 * stats::median(stats::dist(X))^2)), kxz = kernlab::rbfdot(1/(2 * stats::median(stats::dist(cbind(X, Z)))^2)), eps = 0.001, appro = FALSE, tol = 1e-05 )
Y |
a matrix (n by dy) |
X |
a matrix (n by dx) or |
Z |
a matrix (n by dz) |
ky |
a function k(y, y') of class |
kx |
the kernel function for X |
kxz |
the kernel function for (X, Z) or for Z if X is empty |
eps |
a small positive regularization parameter for inverting the empirical cross-covariance operator |
appro |
whether to use incomplete Cholesky decomposition for approximation |
tol |
tolerance used for incomplete Cholesky decomposition (implemented by the function |
The kernel partial correlation (KPC) coefficient measures the conditional dependence
between Y and Z given X, based on an i.i.d. sample of (Y, Z, X).
It converges to the population quantity (depending on the kernel) which is between 0 and 1.
A small value indicates low conditional dependence between Y and Z given X, and
a large value indicates stronger conditional dependence.
If X = NULL
, it measures the unconditional dependence between Y and Z.
The algorithm returns a real number which is the estimated KPC.
KPCgraph
n = 500 set.seed(1) x = rnorm(n) z = rnorm(n) y = x + z + rnorm(n,1,1) library(kernlab) k = vanilladot() KPCRKHS(y, x, z, k, k, k, 1e-3/n^(0.4), appro = FALSE) # 0.4854383 (Population quantity = 0.5) KPCRKHS(y, x, z, k, k, k, 1e-3/n^(0.4), appro = TRUE, tol = 1e-5) # 0.4854383 (Population quantity = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.