# p-values of Mann-Whitney U test identical for raw and log-transformed data

I am new to Stats and came across this problem while running my analyses on SPSS which I cannot explain.

How is it that even after transforming my data by logging it, it still has the same p-value as the raw data set that was not transformed?

The Mann-Whitney U test is a rank test. This means it results depend only of the ranks of your data. The Wikipedia Article describes it quite well, but basically it looks whether the ranks of one sample tend to be higher than in the other one.

Since the logarithm is a strictly monotone function it does not change the ranks of your data.

• The only exception would be if some of your values are zero or negative. The logarithm is not defined for zero or for negative numbers. So in this crazy case, you'd lose some data in the transform, so would get different results. Mar 21, 2013 at 18:33

The Mann-Whitney is a test based on the ranks (/relative orderings) of the data points -- the value of the test statistic only depends on the order (the ranks) of the observations, not on their individual values.

Taking logs (of positive values), or indeed, any other monotonic transformation of the values (like taking $-1/x$ with positive data values, or cubing a set of values) will not change the order (and hence the ranks assigned to observations), only their relative spacing, so the statistic won't be affected. (Even a monotonic decreasing transformation won't change the p-value of the two-tailed test.)