# Lecture 6

We discussed the Mann-Whitney-Wilcoxin nonparametric procedure for testing the equality of the medians of two populations and permutations tests as an alternative which is especially useful when the data contains too many ties.

The Mann-Whitney-Wilcoxin test is under Stat > Nonparametrics > Mann-Whitney.

The data used in class is the amount of nickle in the lungs of Legionnaire victims and control cases (originally from Chen et al. 1977, used in Biostatistics by van Belle et al.):

```Legionnaire	Control
65	12
24	10
52	31
86	6
120	5
82	5
399	29
87	9
139	12

```

The following code is for exploring the robustness in the Mann-Whitney test for a difference between medians against departures from the assumption of equal variances/same shape of the two distributions being compared.

```GMACRO
MannWhitneyRobustness
Name k1 "loop"
Name k2 "SampleSize1"
Name k3 "SampleSize2"
Name k4  "W"
Name k5  "Z"

Let SampleSize1 = 10
Let SampleSize2 = 10

Do k1 = 1:100
Random  SampleSize1  c1;
Normal 2 1.0.
Random SampleSize2 c2;
Normal 0.0 1.0.
Stack c1 c2 c4;
subscripts c3.
rank c4 c5
unstack c5 c6 c7;
subscripts c3.
Let W= Sum(c6)
Let Z = abs((W  - SampleSize1*(SampleSize1 + SampleSize2 + 1)/2)) - 0.5
Let Z = Z/Sqrt(SampleSize1*SampleSize2*(SampleSize1 + SampleSize2+1)/12)

if Z> 1.96
let c10(k1) = 0
else
let c10(k1) = 1
endif
enddo
Let c11(1) = sum(c10)/100
ENDMACRO

```