lcor: Lancaster correlation

View source: R/lcor.R

lcorR Documentation

Lancaster correlation

Description

Computes the Lancaster correlation coefficient.

Usage

lcor(x, y = NULL, type = c("rank", "linear"))

Arguments

x

a numeric vector, or a matrix or data frame with two columns.

y

NULL (default) or a vector with same length as x.

type

a character string indicating which lancaster correlation is to be computed. One of "rank" (default), or "linear": can be abbreviated.

Details

Let F_X and F_Y be the distribution functions of X and Y, and define

X^* = \Phi^{-1}(F_X(X)), \quad Y^* = \Phi^{-1}(F_Y(Y)),

where \Phi^{-1} is the standard normal quantile function. Furthermore for X and Y with finite fourth moment, let

\tilde{X} = (X - \mathbb{E}(X)) / \operatorname{sd}(X), \quad \tilde{Y} = (Y - \mathbb{E}(Y)) / \operatorname{sd}(Y).

Then

\rho_L(X,Y) = \max\{|\operatorname{Cor}_{\text{Pearson}}(X^*,Y^*)|,\; | \operatorname{Cor}_{\text{Pearson}}((X^*)^2,(Y^*)^2)|\}

and

\rho_{L,1}(X,Y) = \max\{|\operatorname{Cor}_{\text{Pearson}}(X,Y)|,\; | \operatorname{Cor}_{\text{Pearson}}((\tilde{X})^2,(\tilde{Y})^2)|\}

are called the Lancaster correlation coefficient and the linear Lancaster correlation coefficient, respectively. Two estimation methods are supported:

  • Linear estimator for \bold{\rho_{L,1}} (type = "linear"): Consider \rho_{L1} = \operatorname{Cor}_{\text{Pearson}}(X,Y) and \rho_{L2} = \operatorname{Cor}_{\text{Pearson}}((\tilde{X})^2,(\tilde{Y})^2). Let \hat\rho_{L1} be the sample Pearson correlation and \hat\rho_{L2} the empirical correlation of the squares of the empirically standardized observations, and set \hat\rho_{L,1} = \max\{\,|\hat\rho_{L1}|,\;|\hat\rho_{L2}|\,\}.

  • Rank-based estimator for \bold{\rho_{L}} (type = "rank"): Consider \rho_{R1} = \operatorname{Cor}_{\text{Pearson}}(X^*,Y^*) and \rho_{R2} = \operatorname{Cor}_{\text{Pearson}}((X^*)^2,(Y^*)^2). Let Q_i and R_i be the ranks of X_i and Y_i, within X_1,...,X_n or Y_1,...,Y_n respectively. Define

    \hat\rho_{R1} = \frac{1}{n\,s_a^2}\sum_{j=1}^n a(Q_j)\,a(R_j),

    \hat\rho_{R2} = \frac{1}{n\,s_b^2}\sum_{j=1}^n \bigl(b(Q_j)-\bar b\bigr)\,\bigl(b(R_j)-\bar b\bigr),

    where the scores are, for j=1,...,n,

    a(j) = \Phi^{-1}\!\Bigl(\frac{j}{n+1}\Bigr), \quad b(j)=a(j)^2,

    \bar b=\frac{1}{n}\sum_{j=1}^n b(j), \quad s_a^2 = \frac{1}{n}\sum_{j=1}^n\bigl(a(j)-\bar a\bigr)^2, \quad s_b^2 = \frac{1}{n}\sum_{j=1}^n\bigl(b(j)-\bar b\bigr)^2.

    Finally, the rank‐based Lancaster correlation is

    \hat\rho_{L} = \max\bigl\{\,|\hat\rho_{R1}|, |\hat\rho_{R2}|\bigr\}.

Value

the sample Lancaster correlation.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024). "Lancester correlation - a new dependence measure linked to maximum correlation". \Sexpr[results=rd]{tools:::Rd_expr_doi("https://doi.org/10.1111/sjos.12733")}

See Also

lcor.comp, lcor.ci, lcor.test

Examples

Sigma <- matrix(c(1,0.1,0.1,1), ncol=2)
R <- chol(Sigma)
n <- 1000
x <- matrix(rnorm(n*2), n)
lcor(x, type = "rank")
lcor(x, type = "linear")

x <- matrix(rnorm(n*2), n)
nu <- 2
y <- x / sqrt(rchisq(n, nu)/nu)
cor(y[,1], y[,2], method = "spearman")
lcor(y, type = "rank")


lancor documentation built on Aug. 22, 2025, 9:16 a.m.