# Mann-Whitney U test

1. May 6, 2013

### Drudge

Could some one tell me how to count a U test? I can´t find it anywhere!

So I know you rank the values from smallest to biggest across each sample (if that makes any sense to you) and then you count the ranks together and use the following equation:

U = n(1) * n(2) + ( n(1) * [ n(2) + 1])/2 - R

hope that makes sense. I do not know how to write proper eqautions. However, it is the samples n multiplied + the samples multiplied (and the other +1) and divided by 2, and finally - R, which is the sum of ranks of x(1) I think.

So then you are supposed to look up on a U-test table and check if U or U(1) is smaller than the critical number, and if so then you rule out Null hypothesis that they are the same.

So I am sure anyone who knows this, knows what I am talking about.

So my question is about how do you get the Z value from this? My book requires it, but does not explain how to. Also online calculators (such as http://www.vassarstats.net/utest.html ) give you the z value.

Last edited: May 6, 2013
2. May 7, 2013

3. May 7, 2013

### Drudge

Ok thank you.

What is U for the following data?

2, 0, 6, 1, 8, 4, 3, 2, 5, 4, 5, 3, 1, 7, 6, 5, 4, 5, 5, 4

7, 8, 3, 6, 6, 7, 3, 4, 3, 5, 8, 6, 9, 2, 4, 5

When I enter these into http://www.vassarstats.net/utest.html I get U(a) to be 214.

Now I understood that U is the sum of ranks - the two n....( as stated in my first post). This way i get 174, when it should be 214, which when put into the z-equation at http://math.usask.ca/~laverty/S245/Tables/wmw.pdf gives the right answer.

why am I not getting the right value to calculate U (and therefore z)?

EDIT: to clarify, I rank all the data, in the same way as the calculator at the above mentioned site,( so they should be correct), then I add up all the ranks together from the first column (data where n = 20) and I get 316, then I use the equation in my first post and get 174, when I should be getting 214 apparently

Last edited: May 7, 2013
4. May 7, 2013

### chiro

Just for clarification, are you trying to calculate the median of your data?

5. May 8, 2013

### Drudge

I think that is what the U-test tries for, no?

I am studying a statistic book for an exam. There is a problem there as such:

Two groups (<40 & 40<) are measured for the amount of hours they utilize medical services. The results in hours are given respectively in the data I posted last.

Problem: test, do the groups differ with a U test

(answer = U [this means z] = -1,72. This answer you can get from the eqaution you provided in your previous post if you use the U value of 214 of 106 (that is 20(n) * 16(n) - 214).

In my book the only instructions are that you count up the sum of ranks, then you apply the appropriate eqaution and you get U. It does not tell you how to get z however. All well and good though, you can get it when you use the equation that you said, so great.

Why can I not get the right U value? Am I doing something wrong? If you were to count the whole problem from the raw data I gave in my previous post, what would you do different to what I have now explained, and is it something I am doing wrong are what is uP?

6. May 8, 2013

### chiro

If you want to make it easier for the readers, you might want to tell us what the median and then give us the rankings for each of the observations.

Note that a rank for an observation is the number of below-ranked observations that appear before the upper-ranked observations.

7. May 8, 2013

### Drudge

I Do not understand

DATA:

2, 0, 6, 1, 8, 4, 3, 2, 5, 4, 5, 3, 1, 7, 6, 5, 4, 5, 5, 4

7, 8, 3, 6, 6, 7, 3, 4, 3, 5, 8, 6, 9, 2, 4, 5

RANKS(respectively):

5, 1, 27, 2.5, 34, 14.5, 9, 5, 21, 14.5, 21, 9, 2.5, 31, 27, 21, 14.5, 21, 21, 14.5 (= 316)

31, 34, 9, 27, 27, 31, 9, 14.5, 9, 21, 34, 27, 36, 5, 14.5, 21 (= 350)

$U = 20 * 16 +\frac{20 * (16+1)}{2} -316 = 174$

Last edited: May 8, 2013
8. May 8, 2013

### chiro

For the data point 2 you have 0 and 1 and totaling these gives (0,0,1) which is 3 instead of 2. How have you calculated the ranks?

9. May 8, 2013

### Drudge

Gosh, I have no idea what you mean.

I place each row into a column. Then, beginning from the smallest of each column (this case 0) I begin to rank values ( 0 is smallest so it is 1). For tied ranks I add up the ranks, say, in row 1 there was two 1s so there ranks would be 2 and 3, and 2 + 3/2 is 2.5, so I rank both numbers with 2.5.

Then there are three 2s, so, ( 4 + 5 + 6 ) / 3 = 5, and therefore I rank each 2 with a 5 and so on...

10. May 9, 2013

### Drudge

I might mention that whatever I am doing (wrong) seems to be sufficient enough (according to the answer sheets in my books), when there are no tied data. Since there is no elaboration what to do with tied data in my book, I assume I am missing something that has to do with that, maybe?

By the way, what does the z-value from a U-test indicate? Is it not a normal distribution parameter? what could it have to do with a U-test? To indicate significance?