Package 'PermCor'

Title: Robust Permutation Tests of Correlation Coefficients
Description: Provides tools for statistical testing of correlation coefficients through robust permutation method and large sample approximation method. Tailored to different types of correlation coefficients including Pearson correlation coefficient, weighted Pearson correlation coefficient, Spearman correlation coefficient, and Lin's concordance correlation coefficient.The robust permutation test controls type I error under general scenarios when sample size is small and two variables are dependent but uncorrelated. The large sample approximation test generally controls type I error when the sample size is large (>200).
Authors: Mengyu Fang [aut, cre], Han Yu [aut], Alan Hutson [aut]
Maintainer: Mengyu Fang <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-12-05 07:01:50 UTC
Source: CRAN

Help Index


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

Robust Permutation Tests of Correlation Coefficients

Description

This function performs robust permutation tests for various correlation coefficients, providing reliable type I error control under general scenarios, especially when the sample size is small and two variables are dependent but uncorrelated.

Usage

perm_test(
  x,
  y,
  B = 1000,
  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.

B

an integer number of permutations.

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.

DiCiccio, C. J., & Romano, J. P. (2017). Robust permutation tests for correlation and regression coefficients. Journal of the American Statistical Association, 112(519), 1211-1220.

Hutson, A. D., & Yu, H. (2021). A robust permutation test for the concordance correlation coefficient. Pharmaceutical Statistics, 20(4), 696-709.

Yu, H., & Hutson, A. D. (2024). A robust Spearman correlation coefficient permutation test. Communications in Statistics-Theory and Methods, 53(6), 2141-2153.

Yu, H., & Hutson, A. D. (2024). Inferential procedures based on the weighted Pearson correlation coefficient test statistic. Journal of Applied Statistics, 51(3), 481-496.

Examples

set.seed(123)
x <- rnorm(20)
y <- rnorm(20)
perm_test(x, y, B = 500, method = "Pearson", alternative = "greater")

perm_test(x, y, B = 500, method = "Spearman", alternative = "two.sided")

perm_test(x, y, B = 500, w = rep(0.05,20), method = "wtdPearson", alternative = "less")

perm_test(x, y, B = 500, r0 = -0.5, method = "CCC", alternative = "greater")