KPCRKHS: Kernel partial correlation with RKHS method

View source: R/KPC.R

KPCRKHSR 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 NULL if X is empty

Z

a matrix (n by dz)

ky

a function k(y, y') of class kernel. It can be the kernel implemented in kernlab e.g., Gaussian kernel: rbfdot(sigma = 1), linear kernel: vanilladot().

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 inchol in the package kernlab)

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

KPCgraph

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)

KPC documentation built on Oct. 6, 2022, 1:05 a.m.

Related to KPCRKHS in KPC...