SignRank
Distribution of the Wilcoxon Signed Rank Statistic

Description

Calculates density, cumulative probability, quantile, and generate random sample for the distribution of the Wilcoxon signed rank statistic (discrete).

Usage

dsignrank(x, n, log = FALSE) # density
psignrank(q, n, lower.tail = TRUE, log.p = FALSE) # probability
qsignrank(p, n, lower.tail = TRUE, log.p = FALSE) # quantile
rsignrank(nn, n) # random

Arguments

x, q a numeric vector of values in the range [0, n*(n+1)/2] that specify the quantiles.
p a numeric vector in the range [0, 1] that specifies the probabilities.
nn an integer in the range [0, Inf) that specifies the number of random samples requested. The input value is truncated if it is not an integer. If length(nn) is greater than 1, the random function returns length(nn) random samples.
n a vector of integers in the range [0, Inf) that specifies the numbers of observations in the samples. If x, q, p, or n are vectors of different lengths, the elements of the shorter vector are replicated cyclically until the length of the vectors are equal.
log a logical value. If FALSE (default), the density function returns the density itself. If TRUE, it returns the log of the density.
lower.tail a logical value. If TRUE (default), the probability supplied to the quantile function or returned by the probability function is P[X <= x]. If FALSE, it is P[X > x].
log.p a logical value. If FALSE (default), the probability supplied to the quantile function or returned by the probability function is the probability itself. If TRUE, it is the log of the probability.

Details

The distribution parameter(s) are replicated cyclically so that they have the same length as the input x, q, p, or the number of random samples requested.
Missing values (NAs) in the input or the distribution parameter(s) will cause the corresponding elements of the result to be missing.
Value
returns the density (dsignrank), cumulative probability (psignrank), quantiles (qsignrank), or random sample (rsignrank) for the Wilcoxon signed rank statistic distribution with parameters n. The quantile is defined as the smallest value q such that Pr(Wilcoxon signed rank statistic random variate <= q) >= p.
Side Effects
If the .Random.seed dataset exists, the random sample function updates the .Random.seed value. The random sample function creates the .Random.seed dataset if it does not exist.
Background
For a random sample x, the Wilcoxon signed rank statistic is the sum of the ranks of the absolute values of x, for which x is positive. This statistic takes value between 0 and n(n+1)/2.
References
Hollander, M. and Wolfe, D. (1973). Non-parametric Statistical Methods. Wiley, New York.
See Also
wilcox.test, dwilcox, pwilcox,qwilcox, set.seed
Examples
dsignrank(11:20, 9)  # density for x <- 11:20
psignrank(24, 8)   # the probability of q <= 24
psignrank(24, 7, lower.tail = FALSE, log.p = TRUE)   # the probability of q > 24
qsignrank(0.345, 5)
rsignrank(5, 9)
Package stats version 6.0.0-69
Package Index