Package 'lancor'

Title: Statistical Inference via Lancaster Correlation
Description: Implementation of the methods described in Holzmann, Klar (2024) <doi:10.48550/arXiv.2303.17872>. 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] , Hajo Holzmann [aut]
Maintainer: Bernhard Klar <[email protected]>
License: GPL-2
Version: 0.1.2
Built: 2025-01-31 04:09:15 UTC
Source: https://github.com/cran/lancor

Help Index


ACE permutation test of independence

Description

Performs a permutation test of independence using ace in package acepack. ace stands for alternating conditional expectations.

Usage

ace.test(x, y = NULL, nperm = 999)

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.

nperm

number of permutations.

Value

A list containing the following components:

ace

the value of the test statistic.

pval

the p-value of the test.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024) Lancester correlation - a new dependence measure linked to maximum correlation. arXiv:2303.17872

See Also

lcor.test

Examples

n <- 200
x <- matrix(rnorm(n*2), n)
nu <- 2
y <- x / sqrt(rchisq(n, nu)/nu) #multivariate t
cor.test(y[,1], y[,2], method = "spearman")
ace.test(y)

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.

Value

⁠lcor⁠ returns the sample Lancaster correlation.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024) Lancester correlation - a new dependence measure linked to maximum correlation. arXiv:2303.17872

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")

confidence intervals for the Lancaster correlation coefficient

Description

Computes confidence intervals for the Lancaster correlation coefficient. Lancaster correlation is a bivariate measures of dependence.

Usage

lcor.ci(x, y = NULL, conf.level = 0.95, type = c("rank", "linear"), con = TRUE,
        R = 1000, method = c("plugin", "boot", "pretest"))

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.

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.

Value

⁠lcor.ci⁠ returns a vector containing the lower and upper limits of the confidence interval.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024) Lancester correlation - a new dependence measure linked to maximum correlation. arXiv:2303.17872

See Also

lcor, lcor.comp, lcor.test

Examples

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")

Lancaster correlation and its components

Description

Computes the Lancaster correlation coefficient and its components.

Usage

lcor.comp(x, y = NULL, type = c("rank", "linear"), plot = FALSE)

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.

plot

logical; if TRUE, scatterplots of the transformed x and y values and of their squares are drawn.

Value

⁠lcor.comp⁠ returns a vector containing the two components ⁠rho1⁠ and ⁠rho2⁠ and the sample Lancaster correlation.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024) Lancester correlation - a new dependence measure linked to maximum correlation. arXiv:2303.17872

See Also

lcor, 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) 
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

Description

Lancaster correlation test of bivariate independence. Lancaster correlation is a bivariate measures of dependence.

Usage

lcor.test(x, y = NULL, type = c("rank", "linear"), nperm = 999,
          method = c("permutation", "asymptotic", "symmetric"))

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.

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.

Value

A list containing the following components:

lcor

the value of the test statistic.

pval

the p-value of the test.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024) Lancester correlation - a new dependence measure linked to maximum correlation. arXiv:2303.17872

See Also

lcor, lcor.comp, lcor.ci

Examples

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")

Covariance matrix of components of Lancaster correlation coefficient.

Description

Estimate of covariance matrix of the two components of Lancaster correlation. Lancaster correlation is a bivariate measures of dependence.

Usage

Sigma.est(xx)

Arguments

xx

a matrix or data frame with two columns.

Value

⁠Sigma.est⁠ returns the estimated covariance matrix.

Author(s)

Hajo Holzmann, Bernhard Klar

References

Holzmann, Klar (2024) Lancester correlation - a new dependence measure linked to maximum correlation. arXiv:2303.17872

See Also

lcor.ci

Examples

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)