MathGroup Archive 2009

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

Search the Archive

computing expectations for probability distributions in mathematica

  • To: mathgroup at
  • Subject: [mg105288] computing expectations for probability distributions in mathematica
  • From: per <perfreem at>
  • Date: Wed, 25 Nov 2009 23:04:31 -0500 (EST)

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)).

  • Prev by Date: Re: When Wolfram's technical support cannot help
  • Next by Date: Re: Re: Color depth - Wikipedia, the free
  • Previous by thread: Re: How to make large graphics object fit within a plot?
  • Next by thread: Re: computing expectations for probability