2

I would need some help on the following problem:

We consider two random variables $X$ and $Y$.

We suppose that, given X=x, the conditional law of $Y$ is a Poisson distribution of parameter $x$.

$X$ follows an exponential distribution of parameter $\lambda >0$.

We are trying to find $E(Y)$ and $V(Y)$.

I'm using the total probability formula first to find the unconditional distribution of $Y$:

$ P(Y=n)=\int _{ 0 }^{ +\infty }{ P(Y=n/X=x)P(X=x) } dx=\int _{ 0 }^{ +\infty }{ { e }^{ -x }\frac { { x }^{ n } }{ n! } \times \lambda { e }^{ -\lambda x } } dx=\frac { \lambda }{ n! } \int _{ 0 }^{ +\infty }{ { { x }^{ n }e }^{ -(\lambda +1)x } } dx=\frac { \lambda }{ n! } { e }^{ \lambda +1 }\int _{ 0 }^{ +\infty }{ { { x }^{ n }e }^{ -x } } dx $

So,

$E(Y)=\frac { \lambda }{ n! } { e }^{ -(\lambda +1) }\int _{ 0 }^{ +\infty }{ { { x }^{ n+1 }e }^{ -x } } dx$

$E({ Y }^{ 2 })=\frac { \lambda }{ n! } { e }^{ -(\lambda +1) }\int _{ 0 }^{ +\infty }{ { { x }^{ n+2 }e }^{ -x } } dx $

$V(Y)=E({ Y }^{ 2 })-E(Y)^{ 2 }$

What I'm stuck with is the calculation of $\int _{ 0 }^{ +\infty }{ { { x }^{ n+1 }e }^{ -x } } dx$ and $\int _{ 0 }^{ +\infty }{ { { x }^{ n+2 }e }^{ -x } } dx$

because I'm supposed to get a simple result for $E(Y)$ and $V(Y)$. Doing an integration by parts won't solve the expression very much I think.

Update:

Given the feedback from André Nicolas:

$ E(Y)=\frac { \lambda }{ n! } { e }^{ \lambda +1 }\int _{ 0 }^{ +\infty }{ { { x }^{ n+1 }e }^{ -x } } dx=\frac { \lambda }{ n! } { e }^{ \lambda +1 }(n+1)!=\lambda { e }^{ \lambda +1 }(n+1) $

$ E({ Y }^{ 2 })=\frac { \lambda }{ n! } { e }^{ \lambda +1 }\int _{ 0 }^{ +\infty }{ { { x }^{ n+2 }e }^{ -x } } dx=\frac { \lambda }{ n! } { e }^{ \lambda +1 }(n+2)!=\lambda { e }^{ (\lambda +1) }(n+1)(n+2) $

which does not match any expected answer.

2nd attempt: now with a change of variable:

$ w=(\lambda +1)x\rightarrow x=\frac { w }{ \lambda +1 } \rightarrow dw=(\lambda +1)dx\rightarrow dx=\frac { dw }{ \lambda +1 } $

$E(Y)=\frac { \lambda }{ n! } \int _{ 0 }^{ +\infty }{ { { x }^{ n+1 }e }^{ -(\lambda +1)x } } dx=\frac { \lambda }{ n! } \int _{ 0 }^{ +\infty }{ { e }^{ -w } } { \left( \frac { w }{ \lambda +1 } \right) }^{ n+1 }\frac { dw }{ \lambda +1 } =\frac { \lambda }{ n! } { \left( \frac { 1 }{ \lambda +1 } \right) }^{ n+2 }(n+1)!=n{ \left( \frac { 1 }{ \lambda +1 } \right) }^{ n+2 } $

Third attempt, following hints from Did and André:

$ P(Y=n)=\int _{ 0 }^{ +\infty }{ P(Y=n/X=x)P(X=x) } dx=\int _{ 0 }^{ +\infty }{ { e }^{ -x }\frac { { x }^{ n } }{ n! } \times \lambda { e }^{ -\lambda x } } dx=\frac { \lambda }{ n! } \int _{ 0 }^{ +\infty }{ { { x }^{ n }e }^{ -(\lambda +1)x } } dx=\frac { \lambda }{ n! } { e }^{ \lambda +1 }\int _{ 0 }^{ +\infty }{ { { x }^{ n }e }^{ -x } } dx=\frac { n!\lambda }{ n! } { e }^{ \lambda +1 }=\lambda { e }^{ \lambda +1 } $ which does not depends on $n$, so strange.

and therefore:

$ E(Y)=\sum _{ n=0 }^{ \infty }{ nP(Y=n) } =\sum _{ n=0 }^{ \infty }{ n\lambda { e }^{ \lambda +1 } } =\lambda { e }^{ \lambda +1 }\sum _{ n=0 }^{ \infty }{ n } $ which does not converge, so must be wrong.

Fourth Attempt:

After getting the right $ P(Y=n)$ from André:

$ E(Y)=\sum _{ n=0 }^{ \infty }{ nP(Y=n) } =\sum _{ n=0 }^{ \infty }{ n\frac { \lambda }{ (\lambda +1)^{ n+1 } } } =\frac { \lambda }{ (\lambda +1) } \sum _{ n=0 }^{ \infty }{ n{ { (\frac { 1 }{ (\lambda +1) } ) } }^{ n } } =\frac { \lambda }{ (\lambda +1) } \frac { \frac { 1 }{ (\lambda +1) } }{ { \left( 1-\frac { 1 }{ (\lambda +1) } \right) }^{ 2 } } =\frac { \lambda }{ { (\lambda +1) }^{ 2 } } \frac { 1 }{ { \left( \frac { \lambda }{ (\lambda +1) } \right) }^{ 2 } } =\frac { \lambda }{ { (\lambda +1) }^{ 2 } } \frac { { \left( \lambda +1 \right) }^{ 2 } }{ { { \lambda }^{ 2 } } } =\frac { 1 }{ \lambda } $

I used the following identity:

$\sum _{ k=0 }^{ \infty }{ k{ x }^{ k } } =\frac { x }{ { (1-x) }^{ 2 } } $

XCoder
  • 482
  • I can go through your full calculation, but at the end, isn't $(n+1)!/n!=n+1$? – André Nicolas Jul 17 '14 at 22:29
  • Yes, you're right. Fixed it. But the result still looks far away from what is expected. I can't see what I did wrong now. – XCoder Jul 17 '14 at 22:31
  • Your first mistake is at the last equal sign in the line starting with P(Y=n). – Did Jul 17 '14 at 22:36
  • You have incorrectness early on, in the setup of the first integral. Apart from constants, you want to integrate $x^n e^{-(\lambda+1)x}$. Make the substitution $w=(\lambda+1)x$, – André Nicolas Jul 17 '14 at 22:37
  • Sorry, the step I indicated in my previous comment is still wrong. You might want to write down the change of variable in details. – Did Jul 17 '14 at 22:49
  • Yes, fixed the first line. Strangely, E(X) was correct. Why should I do a substitution ? Just taking the constants out should do the trick and is much easier, doesn't it ? – XCoder Jul 17 '14 at 22:50
  • You fixed nothing, please see my previous comment for a way out. – Did Jul 17 '14 at 22:55
  • I applied the change of variable, but must have messed up somewhere. Can you give a me a hint please ? – XCoder Jul 17 '14 at 23:20
  • You are supposed to apply the change of variable to each $P(Y=n)$ (going SLOWLY, please), then to go back to $E(Y)$, which is not what you write but $$E(Y)=\sum_nnP(Y=n).$$ As a post hoc check, note that no $n$ should appear in your final formula for $E(Y)$. (Unrelated: Please use @.) – Did Jul 18 '14 at 10:05
  • In your latest summation, you are missing an $n$ and a minus sign. The sum is constant times $\sum n \frac{1}{(\lambda+1)^n}$. – André Nicolas Jul 19 '14 at 18:48
  • Sorry, but where are $({ \frac { 1 }{ \lambda +1 } ) }^{ n }$ and the minus sign coming from ? By looking at my calculations, if $P(Y=n)=\lambda { e }^{ \lambda +1 }$, I do not see any mistake in $E(X)$. – XCoder Jul 19 '14 at 18:56
  • I must be wrong somewhere in $P(Y=n)$, but I can't see where. Any idea André ? – XCoder Jul 19 '14 at 19:12

3 Answers3

2

Use the formulas

$\mathbb{E}(Y) = \mathbb{E}(\mathbb{E}(Y|X))$,

$V(Y) = \mathbb{E}(V(Y|X)) + V(\mathbb{E}(Y|X))$

Stelios
  • 3,077
  • Looks like a very elegant solution, as noted by André. I will try this out, when I'm done with this. Thanks for contributing. – XCoder Jul 19 '14 at 20:51
1

We have for positive integers $n$, $$\int_0^\infty x^ne^{-x}\,dx=n!.$$

The calculation is not hard. One uses integration by parts to get a reduction formula.

Added: To simplify $\int_0^\infty x^n e^{-(\lambda+1)x}\,dx$, let $w=(\lambda+1)x$. Then $dx=\frac{1}{\lambda+1}\,dw$ and $x^n=\frac{1}{(\lambda+1)^n}w^n$. So we end up with $\int_0^\infty \frac{1}{(\lambda+1)^{n+1}}w^ne^{-w}\,dw$. And now use the first part of the answer.

More Added: When the integration is done as described above, we find that $$\Pr(Y=n)=\frac{\lambda}{(\lambda+1)^{n+1}}.$$

Thus $Y$ has a distribution which is one of the two kinds of geometric random variable, where say the probability of head is $\frac{\lambda}{\lambda+1}$, the probability of tail is $\frac{1}{\lambda+1}$, and $Y$ is the number of tails before the first head. It is easier to remember the related random variable $T$, which is the number of trials before the first head. The expectation of $T$ is the reciprocal of $\frac{\lambda}{\lambda+1}$, and for the expectation of $Y$ we subtract $1$.

Or else you can note that $E(Y)=\sum_{n=0}^\infty n \frac{\lambda}{(\lambda+1)^{n+1}}$. This is a close relative of $\sum_{n=1}^\infty nr^n$, for which you can find closed form formulas, on MSE and elsewhere.

For the variance, the easiest thing to do is to look up the variance of a geometric random variable. Or else compute $E(Y^2)$ or else, a little easier, $E(Y^2-Y)$.

André Nicolas
  • 507,029
  • Thanks André. Always so powerful. I will try to do the calculation and find your result and come back to you, if I can't. Thanks so much. – XCoder Jul 17 '14 at 22:14
  • You are welcome. For generalization to non-integer $n$, you might look at Wikipedia, Gamma function. I am mentioning it because such integrals occur often in probability theory, of course in the Gamma distribution, but other places too. – André Nicolas Jul 17 '14 at 22:23
  • Good to know it, now. I applied the formula to compute E(X). And I get some strange result. Did I something wrong somewhere else, André ? – XCoder Jul 17 '14 at 22:28
  • Sorry, André, but for $E(X)$, we have ${ x }^{ n+1 }$ in the integral, not ${ x }^{ n }$. Correct me I am wrong ? So we should have $\int_0^\infty \frac{1}{(\lambda+1)^{n+2}}w^ne^{-w},dw$ – XCoder Jul 19 '14 at 18:20
  • Oh ok, smart. I'm wondering: may be, I messed up the whole calculation for $E(X)$, as the user Did noted. I should added $n$ to the integral, instead of $x$ to the integral ? Maybe that's why I'm getting such weird results. – XCoder Jul 19 '14 at 18:29
  • We use the integral to find the probability that $Y=n$. After that, you have a discrete random variable, the expectation is a sum. – André Nicolas Jul 19 '14 at 18:29
  • So our whole calculations regarding $E(Y)$ were useless ? – XCoder Jul 19 '14 at 18:33
  • The integration stuff, which you now know how to complete, is needed for the probability that $Y=n$, and so far that is the only issue we have dealt with. Now the expectation of $Y$ is straightforward. We have a sum of the type $K\sum_n^\infty nr^n$. You probably know a closed form for this, it has been done many times on MSE, and is closely related to the expectation of a geometric random variable. This is put in bold because it is a huge hint. – André Nicolas Jul 19 '14 at 18:41
  • Since you were having so much difficulty, I wrote out a pretty detailed outline of the rest. You should make sure that you get at least the integral that gives $\Pr(Y=n)$ compuuted correctly. I have given the answer, and earlier parts of this post dealt with the method. – André Nicolas Jul 19 '14 at 19:28
  • Brilliant, but what confuses me is that $\int _{ 0 }^{ \infty } \frac { 1 }{ (\lambda +1)^{ n+1 } } w^{ n }e^{ -w }, dw=\frac { 1 }{ (\lambda +1)^{ n+1 } } n!$ and not $\int _{ 0 }^{ \infty } \frac { 1 }{ (\lambda +1)^{ n+1 } } w^{ n }e^{ -w }, dw=\frac { 1 }{ (\lambda +1)^{ n+1 } } \lambda $ ?? What I am missing ? – XCoder Jul 19 '14 at 19:40
  • Go back to the beginning of your calculation. You had a $\frac{1}{n!}$ term, which we didn't bother with, because it did not affect the integration. However, the integration produced an $n!$ on top, which conveniently cancels the $\frac{1}{n!}$. – André Nicolas Jul 19 '14 at 19:43
  • Oh yes, Brilliant André, as always. Ok, now I understand the thing. Now, what is not clear, is when I come to the integral. You told me to do the change of variable. Allright, but how should I come to the conclusion (alone), that I had to do THAT. As you saw, my instinct led me simply to take the constant out and apply the Gamma function equality, which would have led me nowhere. Can you please explain this ? – XCoder Jul 19 '14 at 19:47
  • Well, it is likely that when you were doing integration in calculus, you would have seen the substitution to make. But it has been a while. By the way, you might look at the answer by Stelios for a hint at a more sophisticated way of tacking the expectation, and the variance. I took instead, and simultaneously, two points of view. (A) Recognize the distribution function of $Y$ as being "familiar", and then we can remember, or look things up or (B) Write down ean expression for $\sum_n n\Pr(Y=n)$ and sum the infinite series, – André Nicolas Jul 19 '14 at 19:55
  • The two points of view you mentionned are interesting. Nice to have read that. But I insist: what led you to suggest a change of variable ? – XCoder Jul 19 '14 at 20:05
  • That's probably what you would do if integrating $x^4e^{-17x}$. By the way, it is not necessary, one can integrate by parts in any case. But I know that $\int_0^\infty x^ae^{-x},dx$ is a standard integral, which means a change of variable will make thingw look better. It is all quite routine and mechanical. – André Nicolas Jul 19 '14 at 20:09
  • ok thanks. I will thanks to move forward given your insights and will post my results. Thanks again. – XCoder Jul 19 '14 at 20:26
  • You are welcome. Integration comes up a lot in these calculations, and one source of difficulty is that some of it has been forgotten. You may experience troubles in multivariate problems. – André Nicolas Jul 19 '14 at 20:31
  • Yes, you're right. Indeed, I struggled on a similar question. Look here if you're interested: http://math.stackexchange.com/questions/865940/poisson-distribution-given-gamma-distribution. You helped me with the Gamma function I know now, so when I'm ready with this question, I will try to move forward with the link I posted. – XCoder Jul 19 '14 at 20:36
1

One way to compute such integrals is by parametric differentiation: Let $f(t)=\int_0^\infty e^{-t x}\,dx.$ Calculate that integral, then evaluate the first few derivatives at $t=1$ in two different ways.

Semiclassical
  • 15,842