I’m looking at the Mann-Whitney U test from HypothesisTests.jl, and it is described as follows:

Perform a Mann-Whitney U test of the null hypothesis that the probability that an observation drawn from the same population as

`x`

is greater than an observation drawn from the same population as`y`

is equal to the probability that an observation drawn from the same population as`y`

is greater than an observation drawn from the same population as`x`

against the alternative hypothesis that these probabilities are not equal.

I’m wondering if an equivalent kind of test couldn’t be done by simple Bayesian inference. Suppose I have two vectors:

```
using Distributions
using HypothesisTests
using Random
using StatsPlots
using Turing
Random.seed!(5)
u = rand(1:10, 50)
v = rand(2:11, 50)
```

If I call `MannWhitneyUTest(u, v)`

, it fails to reject H_0, with a two-side p-value of 0.1132. Given the way H_0 is stated, could I not just do this in the Bayesian paradigm as follows (it’s literally just the coin toss example from Turing.jl)?:

```
@model function dist_test(y)
p ~ Beta(1, 1)
y ~ filldist(Bernoulli(p), length(y))
return y
end
model = dist_test([rand(u) > rand(v) for _ in 1:50])
chain = sample(model, NUTS(), 1_000)
```

In this case, the Bayesian approach doesn’t “agree” with the frequentist approach since 98%+ of our samples are below 0.5, but we “correctly” infer that the two samples are from different distributions.

I’m not attempting to initiate a debate about Frequentist vs. Bayesian as there’s plenty of material about that already. I’m just wondering if the Bayesian approach I’ve taken here is roughly equivalent to the approach using the Mann-Whitney U test, because it’s much easier for me to understand and explain the Bayesian approach.