| Title: | Statistical Inference via Lancaster Correlation |
|---|---|
| Description: | Implementation of the methods described in Holzmann, Klar (2024) <doi: 10.1111/sjos.12733>. Lancaster correlation is a correlation coefficient which equals the absolute value of the Pearson correlation for the bivariate normal distribution, and is equal to or slightly less than the maximum correlation coefficient for a variety of bivariate distributions. Rank and moment-based estimators and corresponding confidence intervals are implemented, as well as independence tests based on these statistics. |
| Authors: | Bernhard Klar [aut, cre] (ORCID: <https://orcid.org/0000-0002-1419-5473>), Hajo Holzmann [aut], Lucas Iglesias [ctb] |
| Maintainer: | Bernhard Klar <[email protected]> |
| License: | GPL-2 |
| Version: | 0.1.3 |
| Built: | 2026-05-22 18:58:08 UTC |
| Source: | https://github.com/bernhardklar/lancor |
Computes the Lancaster correlation coefficient.
lcor(x, y = NULL, type = c("rank", "linear"))lcor(x, y = NULL, type = c("rank", "linear"))
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. |
Let and be the distribution functions of and , and define
where is the standard normal quantile function. Furthermore for and with finite fourth moment, let
Then
and
are called the Lancaster correlation coefficient and the linear Lancaster correlation coefficient, respectively. Two estimation methods are supported:
Linear estimator for (type = "linear"): Consider and .
Let be the sample Pearson correlation and the empirical correlation of the squares of the empirically standardized observations, and set
.
Rank-based estimator for (type = "rank"): Consider and .
Let and be the ranks of and , within or respectively. Define
where the scores are, for ,
Finally, the rank‐based Lancaster correlation is
the sample Lancaster correlation.
Hajo Holzmann, Bernhard Klar
Holzmann, Klar (2024). "Lancester correlation - a new dependence measure linked to maximum correlation". doi:10.1111/sjos.12733
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")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")
Computes confidence intervals for the Lancaster correlation coefficient. Lancaster correlation is a bivariate measures of dependence.
lcor.ci( x, y = NULL, conf.level = 0.95, type = c("rank", "linear"), con = TRUE, R = 1000, method = c("plugin", "boot", "pretest") )lcor.ci( x, y = NULL, conf.level = 0.95, type = c("rank", "linear"), con = TRUE, R = 1000, method = c("plugin", "boot", "pretest") )
x |
a numeric vector, or a matrix or data frame with two columns. |
y |
NULL (default) or a vector with same length as x. |
conf.level |
confidence level of the interval. |
type |
a character string indicating which lancaster correlation is to be computed. One of "rank" (default), or "linear": can be abbreviated. |
con |
logical; if TRUE (default), conservative asymptotic confidence intervals are computed. |
R |
number of bootstrap replications. |
method |
a character string indicating how the asymptotic covariance matrix is computed if type ="linear". One of "plugin" (default), "boot" or "symmetric": can be abbreviated. |
Computes asymptotic and bootstrap-based confidence intervals for the (linear) Lancaster correlation coefficient (). For more details see lcor.
Asymptotic confidence intervals are derived under two cases (analogously for ; see Holzmann and Klar (2024)):
Case 1: If , the asymptotic interval is
where is the standard normal quantile and is an estimator of the corresponding standard deviation.
Case 2: If , let denote the correlation between the two components and let be the quantile of the asymptotic distribution of . A conservative asymptotic interval is
Additionally, bootstrap-based intervals can be obtained by resampling and estimating the covariance matrix of the rank or linear correlation components.
a vector containing the lower and upper limits of the confidence interval.
Hajo Holzmann, Bernhard Klar
Holzmann, Klar (2024). "Lancester correlation - a new dependence measure linked to maximum correlation". doi:10.1111/sjos.12733
n <- 1000 x <- matrix(rnorm(n*2), n) nu <- 2 y <- x / sqrt(rchisq(n, nu)/nu) # multivariate t lcor(y, type = "rank") lcor.ci(y, type = "rank")n <- 1000 x <- matrix(rnorm(n*2), n) nu <- 2 y <- x / sqrt(rchisq(n, nu)/nu) # multivariate t lcor(y, type = "rank") lcor.ci(y, type = "rank")
Computes the Lancaster correlation coefficient and its components.
lcor.comp(x, y = NULL, type = c("rank", "linear"), plot = FALSE)lcor.comp(x, y = NULL, type = c("rank", "linear"), plot = FALSE)
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. |
plot |
logical; if TRUE, scatterplots of the transformed x and y values and of their squares are drawn. |
For more details see lcor.
a vector containing the two components rho1 and rho2 and the sample Lancaster correlation.
Hajo Holzmann, Bernhard Klar
Holzmann, Klar (2024). "Lancester correlation - a new dependence measure linked to maximum correlation". doi:10.1111/sjos.12733
Sigma <- matrix(c(1,0.1,0.1,1), ncol=2) R <- chol(Sigma) n <- 1000 x <- matrix(rnorm(n*2), n) nu <- 8 y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t cor(y[,1], y[,2]) lcor.comp(y, type = "linear") x <- matrix(rnorm(n*2), n) nu <- 2 y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t cor(y[,1], y[,2], method = "spearman") lcor.comp(y, type = "rank", plot = TRUE)Sigma <- matrix(c(1,0.1,0.1,1), ncol=2) R <- chol(Sigma) n <- 1000 x <- matrix(rnorm(n*2), n) nu <- 8 y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t cor(y[,1], y[,2]) lcor.comp(y, type = "linear") x <- matrix(rnorm(n*2), n) nu <- 2 y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t cor(y[,1], y[,2], method = "spearman") lcor.comp(y, type = "rank", plot = TRUE)
Lancaster correlation test of bivariate independence. Lancaster correlation is a bivariate measures of dependence.
lcor.test( x, y = NULL, type = c("rank", "linear"), nperm = 999, method = c("permutation", "asymptotic", "symmetric") )lcor.test( x, y = NULL, type = c("rank", "linear"), nperm = 999, method = c("permutation", "asymptotic", "symmetric") )
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. |
nperm |
number of permutations. |
method |
a character string indicating how the p-value is computed if type ="linear". One of "permutation" (default), "asymptotic" or "symmetric": can be abbreviated. |
For more details on the testing procedure see in Holzmann, Klar (2024).
A list containing the following components:
lcor |
the value of the test statistic |
pval |
the p-value of the test |
Hajo Holzmann, Bernhard Klar
Holzmann, Klar (2024). "Lancester correlation - a new dependence measure linked to maximum correlation". doi:10.1111/sjos.12733
lcor, lcor.comp, lcor.ci and for for performing an ACE permutation test of independence see acepack (https://cran.r-project.org/package=acepack).
n <- 200 x <- matrix(rnorm(n*2), n) nu <- 2 y <- x / sqrt(rchisq(n, nu)/nu) cor.test(y[,1], y[,2], method = "spearman") lcor.test(y, type = "rank")n <- 200 x <- matrix(rnorm(n*2), n) nu <- 2 y <- x / sqrt(rchisq(n, nu)/nu) cor.test(y[,1], y[,2], method = "spearman") lcor.test(y, type = "rank")
Estimate of covariance matrix of the two components of Lancaster correlation. Lancaster correlation is a bivariate measures of dependence.
Sigma.est(xx)Sigma.est(xx)
xx |
a matrix or data frame with two columns. |
For more details see the Appendix in Holzmann, Klar (2024).
the estimated covariance matrix.
Hajo Holzmann, Bernhard Klar
Holzmann, Klar (2024). "Lancester correlation - a new dependence measure linked to maximum correlation". doi:10.1111/sjos.12733
Sigma <- matrix(c(1,0.1,0.1,1), ncol=2) R <- chol(Sigma) n <- 1000 x <- matrix(rnorm(n*2), n) nu <- 8 y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t Sigma.est(y)Sigma <- matrix(c(1,0.1,0.1,1), ncol=2) R <- chol(Sigma) n <- 1000 x <- matrix(rnorm(n*2), n) nu <- 8 y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t Sigma.est(y)