This function is a modification of the part of the function
evaluates Spearman's rank correlation test. Besides the two approximations
cor.test(,method="spearman"), which are AS89 and the t-distribution,
this function allows to use precomputed null distribution for
n <= 22.
1 2 3
have the same meaning as in
selection of the method to approximate the null distribution
Calculation of the exact null distribution of Spearman's rank correlation statistics
is exponentially hard in
n. This package uses precomputed exact distribution
n <= 22 obtained using Ryser's formula applied to an appropriate monomial
permanent as described in
M.A. van de Wiel and A. Di Bucchianico,
Fast computation of the exact null distribution of Spearman's rho and Page's L statistic
for samples with and without ties, J. Stat. Plann. Inf. 92 (2001), pp. 133-145.
using code written by the author of the package. The resulting distributions are
identical to those computed by an independent program kindly provided by M.A. van de Wiel.
A list with class
"htest" with the same structure as the value
of the function
cor.test(method="spearman"). Except of the
p-value, also the contents is identical.
1 2 3 4 5 6 7 8
x <- 1:10 y <- c(5:1, 6, 10:7) out1 <- spearman.test(x, y) out2 <- spearman.test(x, y, approximation="AS89") out3 <- cor.test(x, y, method="spearman") out1$p.value #  0.05443067 this is the exact value out2$p.value #  0.05444507 approximation obtained from AS89 out3$p.value #  0.05444507 ditto
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.