codec: Estimate the conditional dependence coefficient (CODEC)

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/codec.R

Description

The conditional dependence coefficient (CODEC) is a measure of the amount of conditional dependence between a random variable Y and a random vector Z given a random vector X, based on an i.i.d. sample of (Y, Z, X). The coefficient is asymptotically guaranteed to be between 0 and 1.

Usage

1
codec(Y, Z, X = NULL, na.rm = TRUE)

Arguments

Y

Vector (length n)

Z

Matrix (n by q)

X

Matrix (n by p), default is NULL

na.rm

Remove NAs if TRUE

Details

The value returned by codec can be positive or negative. Asymptotically, it is guaranteed to be between 0 and 1. A small value indicates low conditional dependence between Y and Z given X, and a high value indicates strong conditional dependence. The codec function is used by the foci function for variable selection.

Value

The conditional dependence coefficient (CODEC) of Y and Z given X. If X == NULL, this is just a measure of the dependence between Y and Z.

Author(s)

Mona Azadkia, Sourav Chatterjee, Norman Matloff

References

Azadkia, M. and Chatterjee, S. (2019). A simple measure of conditional dependence. https://arxiv.org/pdf/1910.12327.pdf.

See Also

foci, xicor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
n = 1000
x <- matrix(runif(n * 2), nrow = n)
y <- (x[, 1] + x[, 2]) %% 1
# given x[, 1], y is a function of x[, 2]
codec(y, x[, 2], x[, 1])
# y is a function of x
codec(y, x)
z <- rnorm(n)
# y is a function of x given z
codec(y, x, z)
# y is independent of z given x
codec(y, z, x)

FOCI documentation built on March 19, 2021, 1:07 a.m.