Learn R Programming

lancor (version 0.1.2)

lcor.comp: 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)

Value

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

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.

Author

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

Run this code
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)

Run the code above in your browser using DataLab