Learn R Programming

exametrika (version 1.14.0)

chatterjee_xi: Chatterjee's xi correlation coefficient

Description

Computes Chatterjee's (2021) rank-based correlation coefficient xi. Unlike Pearson or Spearman, xi is asymmetric: xi(x, y) and xi(y, x) may differ. This asymmetry is the basis for direction-detection in graphical models.

Usage

chatterjee_xi(x, y, ties_method = "random")

Value

Numeric scalar: Chatterjee's xi value.

Arguments

x

Numeric or ordered factor (predictor)

y

Numeric or ordered factor (response)

ties_method

How to break ties in x. Default "random".

Details

For tied x values, ranks are broken using ties_method. With "random" (the default), each call may produce a slightly different value due to random tie-breaking. Use xi_stable() to average over many randomizations.

References

Chatterjee, S. (2021). A new coefficient of correlation. Journal of the American Statistical Association, 116(536), 2009-2022.

Examples

Run this code
# \donttest{
x <- rnorm(100)
y <- x^2 + rnorm(100, sd = 0.1)
chatterjee_xi(x, y) # near 1, since y is determined by x
chatterjee_xi(y, x) # smaller, since x is not determined by y
# }

Run the code above in your browser using DataLab