1
$\begingroup$

Why does Mathematica simply return this code without an answer;

Expectation[1 - (2 Kt)/(Ka + Kb) \[Conditioned] Ka < Kb, {Ka \[Distributed] BetaDistribution[4 Kt, 4 - 4 Kt], Kb \[Distributed] BetaDistribution[4 Kt, 4 - 4 Kt]}]
$\endgroup$
3
  • 2
    $\begingroup$ That is because Mathematica just doesn't recognize that expectation. However, in this case I believe the condition Ka < Kb is superfluous. All that condition does is randomly toss roughly half of the unconditioned samples. So removing that condition will get you the same answer (and an actual answer). $\endgroup$
    – JimB
    Jun 24, 2018 at 0:56
  • $\begingroup$ 1 - 2 Kt/Expectation[(Ka + Kb), {Ka \[Distributed] BetaDistribution[4 Kt, 4 - 4 Kt], Kb \[Distributed] BetaDistribution[4 Kt, 4 - 4 Kt]}] you can get the expectation of Ka +Kb instead of the whole expression $\endgroup$
    – XinBae
    Jun 24, 2018 at 2:33
  • $\begingroup$ JimB, how do you conclude the condition simply wastes about half the sample? Is that because the expression before the condition already accounts for ka < kb? $\endgroup$
    – user120911
    Jun 24, 2018 at 6:43

1 Answer 1

2
$\begingroup$

The brute force approach is to write the associated integrals directly (by noting that the joint density of Ka and Kb given Ka < Kb is just twice the product of the two marginal densities. Here is the estimate of the mean of 1-Kt/(Ka+Kb) with Kt=1/2:

NIntegrate[(1 - Kt/(Ka + Kb)) 2 ((1 - Ka)^(3 - 4 Kt) Ka^(-1 + 4 Kt))/
   Beta[4 Kt, 4 - 4 Kt] ((1 - Kb)^(3 - 4 Kt) Kb^(-1 + 4 Kt))/
   Beta[4 Kt, 4 - 4 Kt] /. Kt -> 1/2, {Ka, 0, 1}, {Kb, 0, Ka}]
(* 0.427106 *)

It appears that the integral only exists when $1/8 < Kt < 1$.

To justify that the conditioning is unnecessary in this case one can do a bit of handwaving: Because the pivotal statistic is the sum Ka + Kb, Ka and Kb are independent with the same marginal distribution, and we condition on Ka < Kb, such a set of samples from that conditional distribution will be indistinguishable from those conditioned on Ka > Kb. Together those two comprise the complete set of potential samples. Therefore, conditioning on Ka < Kb is unnecessary. (If the marginal distributions of Ka and Kb were different, this would not be the case.)

Additionally, one can check the expected value for various values of Kt and see that the results are identical for the conditioned and unconditioned approaches.

NIntegrate[(1 - Kt/(Ka + Kb)) ((1 - Ka)^(3 - 4 Kt) Ka^(-1 + 4 Kt))/
   Beta[4 Kt, 4 - 4 Kt] ((1 - Kb)^(3 - 4 Kt) Kb^(-1 + 4 Kt))/
   Beta[4 Kt, 4 - 4 Kt] /. Kt -> 1/2, {Ka, 0, 1}, {Kb, 0, 1}]
(* 0.427106 *)
$\endgroup$

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.