This applet computes probabilities for the Wilcoxon signed rank test.
Let $w_1,\ldots,w_n$ be a random sample of size $n$ from a symmetric,
continuous distribution centered at the
origin. The Wilcoxon signed rank statistic $W$ is the sum of the
ranks of the absolute values of the $w$'s for which $w$ is positive.
The statistic $W$ has support $0,1,\ldots,\frac{n(n+1)}{2}$.

#### Directions

- Enter the sample size in the $n$ box.
- Hitting "Tab" or "Enter" on your keyboard will plot the probability mass function (pmf) of the Wilcoxon signed rank statistic $W$.

To compute a probability, select $P(W=w)$ from the drop-down box,
enter a numeric $w$ value, and press "Enter" on your keyboard. The probability
$P(W=w)$ will appear in the
pink box.
Select $P(W \leq w)$ from the drop-down box for a left-tail probability (this is the cdf).

#### Details

- Probability mass function (pmf):

$$f(w)=P(W=w)=\frac{c(w|n)}{2^n}$$
where $c(w|n)$ is the number of subsets of
$\{1,\ldots,n\}$ that sum to $w$ (using the convention that the empty set sums to 0).
See the example below.
- Support: $w=0,1,\ldots,\frac{n(n+1)}{2}$
- $\mu=E(W)=\frac{n(n+1)}{4}$
- $\sigma^2=Var(W)= \frac{n(n+1)(2n+1)}{24}$
- $\sigma=SD(W)= \sqrt{\frac{n(n+1)(2n+1)}{24}}$

#### Example

If n=3, there are two subsets of $\{1,2,3\}$ that sum to 3: $\{3\}$ and $\{1,2\}$. Thus,
$$c(w=3|n=3)=2$$
and
$$f(3)=P(W=3)=\frac{c(3|3)}{2^3}=\frac{2}{8}=0.25.$$
Also, $c(w|n=3)=1$ for $w=0,1,2,4,5,6$. Thus,
$$f(w)=P(W=w)=\frac{1}{8}=0.125$$
for $w=0,1,2,4,5,6$. This distribution is generated and plotted simply by entering $3$ in the $n$ box in the application.