asym_test {PermCor}R Documentation

Large Sample Approximation (Asymptotic) Test of Correlation Coefficients

Description

This function performs a large sample approximation test of correlation coefficients, ensuring control over type I error under general scenarios when the sample size exceeds 200. It is suitable for cases where two variables are dependent but uncorrelated.

Usage

asym_test(
  x,
  y,
  r0 = 0,
  w = NULL,
  method = c("Pearson", "wtdPearson", "Spearman", "CCC"),
  alternative = c("two.sided", "less", "greater")
)

Arguments

x

a numeric vector.

y

a numeric vector.

r0

a numeric denoting the CCC under the null hypothesis. It should be in the range between -1 and 1. This parameter will be ignored for the tests of Pearson, weighted Pearson, or Spearman's correlation coefficient.

w

numeric vector denoting the weights of the elements in vectors x and y.

method

the correlation coefficient to be tested, options include Pearson's correlation coefficient (Pearson), weighted Pearson correlation coefficient (wtdPearson), Spearman's correlation coefficient (Spearman), Lin's concordance correlation coefficient (CCC).

alternative

the alternative hypothesis, can be two.sided, less, or greater.

Details

#' The test supports the following correlation coefficients: Pearson correlation coefficient, Weighted Pearson correlation coefficient, Spearman correlation coefficient, and Lin's concordance correlation coefficient (CCC)

For Pearson, weighted Pearson, and Spearman correlation coefficients, the test supports a zero null hypothesis. The alternative hypothesis can be either one-sided or two-sided.

For Lin's concordance correlation coefficient (CCC), the test accommodates a more general null hypothesis. Currently, the test only supports a one-sided alternative hypothesis (greater).

Value

estimate

the estimated correlation coefficient.

p.value

the p-value from the studentized test.

method

the method for measuring correlation coefficient.

alternative

the alternative hypothesis.

Author(s)

Mengyu Fang, Han Yu, Alan Hutson

References

Lawrence, I., & Lin, K. (1989). A concordance correlation coefficient to evaluate reproducibility. Biometrics, 255-268.

Serfling, R. J. (2009). Approximation theorems of mathematical statistics. John Wiley & Sons.

Examples

set.seed(123)
x <- rnorm(250)
y <- rnorm(250)
asym_test(x, y, method = "Pearson", alternative = "greater")

asym_test(x, y, method = "Spearman", alternative = "two.sided")

asym_test(x, y, w = rep(0.004,250), method = "wtdPearson", alternative = "less")

asym_test(x, y, r0 = -0.5, method = "CCC", alternative = "greater")

[Package PermCor version 0.1.0 Index]