4
$\begingroup$

Suppose I have two random variables:

Control = BetaDistribution[24,141]
Var = BetaDistribution[30,151]

I can sample from this easy enough with RandomVariate[Var, 10] and calculate the probability that one of the distributions is greater than a constant, e.g. Probability[x <= .2, x \[Distributed] Var].

But how do I calculate $P(Var>Control)$. Many thanks!

$\endgroup$
7
$\begingroup$

Very similar:

Probability[
 control < var, {control \[Distributed] BetaDistribution[24, 141], 
  var \[Distributed] BetaDistribution[30, 151]}]

1191614106688032995829016253297371 / 1700223091652404809206230640390474

(roughly 0.7)

Verify numerically:

control = BetaDistribution[24, 141]
var = BetaDistribution[30, 151]
Count[Thread[
  RandomVariate[control, 1000000] < 
   RandomVariate[var, 1000000]], True]

also roughly 0.7

$\endgroup$
3
  • 1
    $\begingroup$ Thanks! That's what I was looking for. One more question. How would I do it with a declared variable -- I'm not sure on the syntax there, e.g. something like: Control = BetaDistribution[24,141]; Var = BetaDistribution[30,151]; Probability[Control < Var, {Control, Var}] $\endgroup$
    – toomey8
    Sep 18 at 15:29
  • $\begingroup$ control = BetaDistribution[24, 141]; var = BetaDistribution[30, 151]; Probability[c < v, {c \[Distributed] control, v \[Distributed] var}] $\endgroup$
    – SHuisman
    Sep 18 at 15:36
  • 1
    $\begingroup$ Thanks, that's perfect! $\endgroup$
    – toomey8
    Sep 18 at 15:42

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.