\Header{SignRank}{Distribution of the Wilcoxon Signed Rank Statistic}
\alias{dsignrank}{SignRank}
\alias{psignrank}{SignRank}
\alias{qsignrank}{SignRank}
\alias{rsignrank}{SignRank}
\keyword{distribution}{SignRank}
\begin{Usage}
\begin{verbatim}
dsignrank(x, n)
psignrank(q, n)
qsignrank(p, n)
rsignrank(nn, n)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{x,q}] vector of quantiles.
\item[\texttt{p}] vector of probabilities.
\item[\texttt{nn}] number of observations to generate.
\item[\texttt{n}] numbers of observations in the sample.  Must be positive
integers less than 50.
\end{ldescription}
\end{Arguments}
\begin{Value}
These functions provide information about the distribution of the
Wilcoxon Signed Rank statistic obtained from a sample with size
\texttt{n}.  \texttt{dsignrank} gives the density, \texttt{psignrank}
gives the distribution function, \texttt{qsignrank} gives the quantile
function, and \texttt{rsignrank} generates random deviates.

This distribution is obtained as follows.  Let \texttt{x} be a sample
of size \texttt{n} from a continuous distribution symmetric about the
origin.  Then the Wilcoxon signed rank statistic is the sum of the
ranks of the absolute values \texttt{x[i]} for which \texttt{x[i]} is
positive.  This statistic takes values between \eqn{0}{} and
\eqn{n(n+1)/2}{}, and its mean and variance are \eqn{n(n+1)/4}{} and
\eqn{n(n+1)(2n+1)/24}{}, respectively.\end{Value}
\begin{Author}
Kurt Hornik \email{hornik@ci.tuwien.ac.at}\end{Author}
\begin{SeeAlso}
\texttt{\Link{dwilcox}} etc, for the \emph{two-sample} Wilcoxon
rank sum statistic.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
par(mfrow=c(2,2))
for(n in c(4:5,10,40)) {
  x <- seq(0, n*(n+1)/2, length=501)
  plot(x, dsignrank(x,n=n), type='l', main=paste("dsignrank(x,n=",n,")"))
}
\end{ExampleCode}
\end{Examples}

