1
$\begingroup$

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.

$\endgroup$
4
  • 1
    $\begingroup$ 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 $\endgroup$
    – b3m2a1
    Nov 16 '21 at 2:49
  • $\begingroup$ I'm pretty confident that the two expressions are equivalent from a theoretical perspective. $\endgroup$
    – dmh
    Nov 16 '21 at 2:56
  • 1
    $\begingroup$ 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$. $\endgroup$
    – JimB
    Nov 16 '21 at 3:13
  • $\begingroup$ any idea why? or how might i find out why? $\endgroup$
    – dmh
    Nov 16 '21 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.