pspearman {pspearman}R Documentation

Distribution function of Spearman's rho

Description

This function provides three types of approximations of the distribution function of Spearman's rho. Besides the two approximations used in cor.test(,method="spearman"), which are AS89 and the t-distribution, this function allows to use precomputed null distribution for n <= 22. See spearman.test for the details of the algorithm used to compute this null distribution.

Usage

    pspearman(s, n, lower.tail = TRUE,
        approximation = c("exact", "AS89", "t-distribution"))

Arguments

s

The observed value of S statistics sum((rank(x) - rank(y))^2).

n

The number of observations.

lower.tail

If TRUE (the default), the probability of S <= s is computed. If FALSE, the probability of S >= s is computed.

approximation

Selection of the method of approximation of the distribution function.

Details

See spearman.test for more detail.

Value

Depending on lower.tail, either the probability of S <= s or of S >= s is computed, where S is the statistics sum((rank(x) - rank(y))^2).

Examples

  pspearman(36, 10, approximation="exact") # [1] 0.005265377
  pspearman(36, 10, approximation="AS89")  # [1] 0.005825634

[Package pspearman version 0.3-1 Index]