Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: computing expectations for probability distributions in mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105297] Re: computing expectations for probability distributions in mathematica
  • From: dh <dh at metrohm.com>
  • Date: Thu, 26 Nov 2009 06:15:29 -0500 (EST)
  • References: <hekuoc$9an$1@smc.vnet.net>


per wrote:

> hi all,

> 

> i am trying to see if there is a simplified expression for a

> particular random variable using mathematica. i have two independent

> binomial random variables, X and Y, and i'd like to compute the

> expectation of X/(X+Y). more formally, X is distributed Binomial(p1,

> n) and Y is distributed Binomial(p2, n).  note that p1 and p2 can be

> different, but the n's are the same. i would like to compute E(X/(X

> +Y)). since the ratio is undefined when X+Y = 0, i would like to

> assume that X+Y >= 1.

> 

> is there a way to compute this expectation and see if it has a

> simplified analytic form subject to this constraint?

> 

> i defined my function to compute the probability of this random

> variable as follows:

> 

> myvar[x_, y_] :=

>  Binomial[n, x]*p1^x*(1 - p1)^(n - x)*Binomial[n, y]*

>   p2^y*(1 - p2)^(n - y)*(x/(x + y))

> 

> now i just want to take the expectation of this. since the value of X

> ranges from 0 to N and the value of Y ranges from 0 to N, it should be

> possible to simply take a sum over X from 0 to N and sum of Y from 0

> to Y to see what this expression evaluates to and whether it has a

> simple analytic form.

> 

> the trick is to take the sum with the constraint of X + Y >= 1 -- how

> can i express this in Mathematica?

> 

> i am also open to computing the expectation of X/(X+Y) by assuming

> they are independent Poissons if that makes the math easier, i.e.

> using poisson approximation to binomial.

> 

> thank you for your help.

> 

> 

> 

>>> where X, Y are independent but p1 and p2 could be different. I am

>>> trying to compute the mean E(X/(X+Y)) but i am stuck. is there an easy

>>> form for this mean? i looked it up in several probability books but

>>> could not get it.

>>> i am willing to make either a Poisson approximation or a Normal

>>> approximation to thebinomialfor my application if i could compute

>>> this mean. if i assume that X and Y are distributed Poisson, i know

>>> that E(X+Y) has a nice form as a function of the rates of the two

>>> poissons, but i still do not know how to get the distribution of X/(X

>>> +Y) so that i can compute the expectation E(X/(X+Y)).

> 

Hi,

you can split your sum into 3 sums:

x=0; y=1..n

y=0; x=1..n;

x=1..n; y=1..n

However, are you sire that you can simply eliminate the case x=0 and 

y=0? Otherwise the expectation value does not exist.

Daniel




  • Prev by Date: Re: Solve how to eliminate variable
  • Next by Date: Re: Re: random walk visualization
  • Previous by thread: Re: computing expectations for probability
  • Next by thread: Re: Re: .NET/LINK USER GUIDE Comment: Calling