Skip to page content

FSC logo
The Seashore

STATS for TWITS

3. Testing the hypothesis ...

Mann-Whitney U test

This test will tell you whether the medians of two sets of data are significantly different to one another. It works on unmatched, interval or ordinal data (see section on "Different kinds of data"). It does not require that the data is normally distributed but it does require that both data sets are the same shape.

Lets say you are investigating the effects of lifestyle on human body size. You feel it to be too much of an intrusion to measure people's weight or girth directly, so you invent a way of assessing their size remotely.

You select two sites: Site one is outside the well known fast-food chain McBloaters. Site two is outside the well known health-food chain McSmugs.

You stand outside both establishments and simply assess the body size of the punters patronising them on the following scale:

1 = Skeletalmmmmm2 = Thinmmmmm3 = Mediummmmmm4 = Plumpmmmmm5 = Fatmmmmm6 = Bloater

You obtain the following results:

Body size scores of people patronising McBloaters and McSmugs

 Sample

1

 2

3

4

5

6

7

8

 Mc Bloaters

 3

2

2

1

4

4

5

2

 Mc Smugs

 5

4

6

3

4

6

3

6

Firstly we state our null hypothesis (it's always the same for this test):

There is no significant difference between the medians of the two sets of data

Next we put the data in order from smallest to highest:

 Mc Bloaters

 1

2

2

2

3

   

 4

4

   

 5

     
                                 
 Mc Smugs          

 3

3

   

 4

4

 

 5

 6

6

6

                                 

Next assign a rank to each piece of data:

 Mc Bloaters

 1

2

2

2

3

   

 4

4

   

 5

     
 RANK

 1

3

3

3

6

9.5 

9.5

   

 12.5

       
 Mc Smugs          

 3

3

   

 4

4

 

 5

 6

6

6

 RANK          

 6

6

   

 9.5

9.5

 

 12.5

 15

15

15

Notice the lowest value is 1 (McBloaters data set), so this receives a rank of 1. Next we have three tied values (three values of 2 from the McBloater data set). These 3 items of data occupy three ranks but they are all of the same value, so we share out the ranks thus: rank 2 + rank 3 + rank 4 = 9. Divide by three and we end up with a rank of 3 for each piece of data. (See the red rank row below McBloaters).

The next values come from the McBloaters and the McSmugs data set: A value of 3 from McBloaters and two tied values of 3 from McSmugs. We deal with these in the same way. We have used ranks up to 4 so the next three ranks that are available are rank 5, rank 6 and rank 7. Add these together and share them out equally: 5 + 6 + 7 = 18/3 = 6.

Continue doing this to complete the table and the only moderately hard part of doing this test is over.

Add up the ranks for each data set:

Sum of McBloater ranks = 47.5

Sum of McSmug ranks = 88.5

Calculate the value U for each sample:

Mann-Whitney formulae

We can now check our calculations because U1 + U2 should equal n1 x n2. Happily, in our case this is indeed true.

We now take the smaller of the two values as our calculated test statistic. Our calulated value of U is then 11.5

Our next task is to compare our calculated value with the critical value obtained from a table of critical values of U:

Table of Critical values of U (5% Significance)

 n1/n2

 1

2

3

4

5

6

7

8

9

 1

                 

 2

                 

 3

       

 1

1

2

2

2

 4

       

 1

2

3

4

4

 5

     

1

2

3

5

6

7

 6

   

 1

2

3

5

6

8

10

 7

   

 1

3

5

6

8

10

12

 8

   

 2

4

6

8

10

13

15

 9

   

 2

4

7

10

12

15

17

 10

   

 3

5

8

11

14

17

20

We enter the table at the correct number of items of data for each data set (row 8 and column 8 in our case). The critical value of U is therefore: 13

Our calculated value of U was 11.5

In a Mann-Whitney U test if the calculated value of U is less than the critical value we reject the null hypothesis. In rejecting our hypothesis of no difference we are saying that the medians of the two sets of data are indeed significantly different. In doing this at the 5% significance level we would expect to be correct in rejecting our null hypothesis 95% of the time.

We might also learn from this example of the dangers of jumping to conclusions. I would bet that most people expected McBloaters to have the fatter people using it. It just goes to show, if you eat too much of anything (even McSmugs lentil surprise) you will get fat. Let our maxim be "tolerance, moderation, healthy exercise, wholesomeness, crispness and rhubarb".

If you've got 25+ samples in both data sets use a z test (see "T test" section).

 

 


Looking for a next step?
The FSC offers a range of publications, courses for schools and colleges and courses for adults, families and professionals that relate to the seashore environment. Why not find out more about the FSC?

FEEDBACK
Do you have any questions?

Copyright © 2008 Field Studies Council  
Creative Commons License
Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Licence
.

Site Statistics by Opentracker