kendall_cor_test() calculates p-value for the the Kendall correlation using the exact values when the number of observations is less than 50. For larger samples, it uses an approximation as in base R.

kendall_cor_test(x, y, alternative = c("two.sided", "greater", "less"))

Arguments

x

a numeric vector.

y

a numeric vector.

alternative

a character string specifying the alternative hypothesis. The possible values are "two.sided", "greater", and "less".

Value

A list with the following components:

statistic

The Kendall correlation coefficient.

p_value

The p-value of the test.

alternative

A character string describing the alternative hypothesis.

References

Knight, W. R. (1966). "A Computer Method for Calculating Kendall's Tau with Ungrouped Data". Journal of the American Statistical Association, 61(314), 436–439.

Abrevaya J. (1999). Computation of the Maximum Rank Correlation Estimator. Economic Letters 62, 279-285.

Christensen D. (2005). Fast algorithms for the calculation of Kendall's Tau. Journal of Computational Statistics 20, 51-62.

Emara (2024). Khufu: Object-Oriented Programming using C++

Examples

x <- c(1, 0, 2)
y <- c(5, 3, 4)
kendall_cor_test(x, y)
#> $statistic
#> [1] 0.3333333
#> 
#> $p_value
#> [1] 1
#> 
#> $alternative
#> [1] "alternative hypothesis: true tau is not equal to 0"
#>