# The Wilcoxon or Mann-Whitney distribution

### 8.4.18 The Wilcoxon or Mann-Whitney distribution

#### The Wilcoxon test polynomial: wilcoxonp

The wilcoxonp command computes the polynomial for the Wilcoxon or Mann-Whitney test.

- wilcoxonp takes one mandatory argument and one optional argument:
  - n, an integer.
  - Optionally, k an integer.
- wilcoxonp(n [,k] returns the polynomial for the Wilcoxon test.

#### Examples.

- Input:
  wilcoxonp(4)
  Output:

  ▯

  1
  16

  ,

  1
  16

  ,

  1
  16

  ,

  1
  8

  ,

  1
  8

  ,

  1
  8

  ,

  1
  8

  ,

  1
  8

  ,

  1
  16

  ,

  1
  16

  ,

  1
  16

  ▯

- Input:
  wilcoxonp(4,3)
  Output:

  ▯

  1
  35

  ,

  1
  35

  ,

  2
  35

  ,

  3
  35

  ,

  4
  35

  ,

  4
  35

  ,

  1
  7

  ,

  4
  35

  ,

  4
  35

  ,

  3
  35

  ,

  2
  35

  ,

  1
  35

  ,

  1
  35

  ▯

#### The Wilcoxon/Mann-Whitney statistic: wilcoxons

The wilcoxons command computes the Wilcoxon or Mann-Whitney statistic.

- wilcoxons takes two arguments:
  - L, a list.
  - M, either a list or a real number (a median).
- wilcoxons(L,M) returns the Wilcoxon statistic.

#### Examples.

- Input:
  wilcoxons([1,3,4,5,7,8,8,12,15,17],10)
  Output:

  18

- wilcoxons([1,3,4,5,7,8,8,12,15,17],[2,6,10,11,13,14,15,18,19,20])
  Output:

  128.5

#### The Wilcoxon or Mann-Whitney test: wilcoxont

The wilcoxont command will perform the Wilcoxon or Mann-Whitney test.

- wilcoxont takes two mandatory arguments and two optional arguments:
  - L, a sample (list).
  - M, either another sample or a number (a median).
  - Optionally, f, a function.
  - Optionally, x, a real number.
- wilcoxont(L,M ⟨ ,f,x⟩) returns the results of the Wilcoxon test.

#### Examples.

- Input:
  wilcoxont([1,2,3,4,5,7,8,8,12,15,17],[2,6,10,11,13,14,15,18,19,20])
  Output:

  `Mann-Whitney 2-sample test, H0 same Median, H1 <>`
  `ranksum 93.0, shifted ranksum 27.0`
  `u1=83 ,u2=27, u=min(u1,u2)=27`
  `Limit value to reject H0 26`
  `P-value 9055/176358 (0.0513444244094), alpha=0.05 H0 not rejected`
  `1`

- Input:
  wilcoxont([1,3,4,5,7,8,8,12,15,17],[2,6,10,11,13,14,15,18,19,20],0.3)
  Output:

  `Mann-Whitney 2-sample test, H0 same Median, H1 <>`
  `ranksum 81.5, shifted ranksum 26.5`
  `u1=73.5 ,u2=26.5, u=min(u1,u2)=26.5`
  `Limit value to reject H0 35`
  `P-value 316/4199 (0.0752560133365), alpha=0.3 H0 rejected`
  `0`

- Input:
  wilcoxont([1,3,4,5,7,8,8,12,15,17] ,10,‘>‘,0.05)
  Output:

  `Wilcoxon 1-sample test, H0 Median=10, H1 M<>10`
  `Wilcoxon statistic: 18, p-value: 0.375, confidence level: 0.05`
  `1`