KPCRKHS {KPC} | R Documentation |
Kernel partial correlation with RKHS method
Description
Compute estimate of Kernel partial correlation (KPC) coefficient using conditional mean embeddings in the reproducing kernel Hilbert spaces (RKHS).
Usage
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
)
Arguments
Y |
a matrix (n by dy) |
X |
a matrix (n by dx) or |
Z |
a matrix (n by dz) |
ky |
a function |
kx |
the kernel function for |
kxz |
the kernel function for |
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 |
Details
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
.
Value
The algorithm returns a real number which is the estimated KPC.
See Also
Examples
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)