I am testing Mann-Whitney rank test with two vectors
b. Vectors are almost similar so I expect a p-value near 0, but the returned p-value is near 1. What is the reason? I read the manual and also run the code with different parameters, but don't get anything near to what I expect.
from scipy.stats import mannwhitneyu import operator import numpy as np a = [1000,100,10,1,10,100,1000,10000,1000,100,10,1] b = [999,100,10,1,10,100,1000,10000,1000,100,10,1] print(mannwhitneyu(a, b))
The output of the code:
Let's formalize the problem to eliminate any misunderstanding (please edit the question if something is wrong):
What I try to prove is that rank distribution of data are approximately equal,
Null hypothesis ($H_0$)= "ranked distribution of a and b are approximately equal"
Alternative hypothesis ($H_a$)= "ranked distribution of a and b are not equal"
significance level (alpha) = 0.05
(p-value > alpha) so there is no sufficient evidence that $H_a$ is correct, but we cannot also conclude that ($H_0$) is true.
Instead if (p-value < alpha) was true, then we would have enough evidence against H0 and Ha can be accepted.
So what happened here is that I could not disprove the null hypothesis. However, it doesn't mean that null hypothesis is false. It is like an investigation to accuse MR X of being guilty:
$H_0$=" MR X guilty" $H_a$=" MR X not guilty"
We guess he is not guilty, but we don't have enough proof against him: (p-value > alpha), but that doesn't mean that ($H_0$) would not be true. If we could obtain enough evidence and state (p-value < alpha), then we disprove $H_0$ and we can conclude that Ha is true and he is not guilty.