# Why does making this expression more complex speed up the call to Probability?

I have the following code:

aucs = Block[{p = 1.},
Table[Probability[
x[1] + z[1] > (x[2] + z[2]) (2 b - 1) \[Conditioned]
x[1] > x[2], {x[1] \[Distributed] NormalDistribution[],
x[2] \[Distributed] NormalDistribution[],
z[1] \[Distributed] NormalDistribution[0, \[Sigma]],
z[2] \[Distributed] NormalDistribution[0, \[Sigma]],
b \[Distributed] BernoulliDistribution[p]}], {\[Sigma], 1, 10,
1}]]


which returns within a few seconds. A very similar piece of code which should be equivalent as far as I can tell, takes much longer to return (actually I don't know how long it takes since I never saw it return a value):

Table[Probability[
x[1] + z[1] > x[2] + z[2] \[Conditioned]
x[1] > x[2], {x[1] \[Distributed] NormalDistribution[],
x[2] \[Distributed] NormalDistribution[],
z[1] \[Distributed] NormalDistribution[0, \[Sigma]],
z[2] \[Distributed] NormalDistribution[0, \[Sigma]]}], {\[Sigma],
1, 10, 1}]


Any idea what the issue might be? In the first case, b is always 1 so the two expressions should be equivalent.

• This is one for the statisticians probably, but it seems the first expression has a simple analytic form while the second does not (or at least Mathematica's symbolic manipulation stuff doesn't find it). Similarly, NProbability complains about poorly conditioned integrals in the second case Nov 16 '21 at 2:49
• I'm pretty confident that the two expressions are equivalent from a theoretical perspective.
– dmh
Nov 16 '21 at 2:56
• I think @b3m2a1 has supplied the answer. As an alternative if you simplify the second table to the theoretically equivalent statement Table[Probability[x[1] > x[2] + z21 \[Conditioned] x[1] > x[2], {x[1] \[Distributed] NormalDistribution[], x[2] \[Distributed] NormalDistribution[], z21 \[Distributed] NormalDistribution[0, Sqrt[2] \[Sigma]]}], {\[Sigma], 1, 10, 1}]//N, you'll get the same result as the first table (but taking about a minute to complete). Your first table even works without having to specify a value for $p$.
– JimB
Nov 16 '21 at 3:13
• any idea why? or how might i find out why?
– dmh
Nov 16 '21 at 15:30