I'm trying to solve a Baysian inference problem (although the details are not all that important for this question)
I define two probability distributions P
and Q
pdf[N_, n_, p_][x_] := (1 + N) (1 - x)^(-n + N) x^n Binomial[N, n]
P = ProbabilityDistribution[pdf[N, n, p][x], {x, 0, 1}]
Q = ProbabilityDistribution[pdf[M, m, q][x], {x, 0, 1}]
Now Mathermatica is very happy to compute the $Pr_{q\sim Q, p\sim P}[q>p]$
Probability[q > p, {q \[Distributed] Q, p \[Distributed] P}]
(* (1 + M) (1 + N) Binomial[M, m] Binomial[N, n] Gamma[1 - m + M] Gamma[
1 + n] Gamma[
2 + m + n] HypergeometricPFQRegularized[{1 + n, 2 + m + n,
n - N}, {2 + n, 3 + M + n}, 1] *)
Side note I'm quite impressed it takes only .2s for this)
However if I try to compute this from a first principles standpoint i.e $$Pr_{q\sim Q, p\sim P}[q>p] = \int_{y>x} f_Q(y) f_P(x) dx dy = \int_{0}^1\int_{x}^1 f_Q(y) f_P(x) dy dx $$ with
Integrate[PDF[Q, y] PDF[P, x], {x, 0, 1}, {y, x, 1}]
I just get stuck waiting. I've also tried adding all assumptions but no luck
$Assumptions = {{m, n} \[Element]
NonNegativeIntegers, {M, N} \[Element] PositiveIntegers,
0 < \[Alpha] < 1, M >= m, N >= n, 0 <= p <= 1, 0 <= q <= 1}
I'd like to understand where this big hypergeometric solution comes from as it's th result of a theorem I want to prove in my research so any hints would be helpful. I figured at least getting the integral result to be equal would give me a start in figuring out how to tackle that integral.
Thanks