# Another distribution problem...

#### Jason

##### New member
I just have this one last question. Could somebody give me a push; not really sure how to start:

Let: $A|B\sim \text{Pois.}(B)$ and $B\sim \text{Exp.}(\mu)$.

I need to find the distribution of $A$

#### Moo

##### New member
Hello,

There are three things to know.
First of all, A will have a discrete distribution : it's essentially a Poisson distribution.
Then there are 2 formulas/properties to know.
When we have $\displaystyle P(A=k)$, it's like writing $\displaystyle E[1_{\{A=k\}}]$ where the 1 function is the indicator function.
And finally, $\displaystyle E[E[X|B]]=E[X]$, where X and B are any random variables.

So here, we'll have :
$\displaystyle P(A=k)=E[1_{\{A=k\}}]=E[E[1_{\{A=k\}}|B]]=E[P(A=k|B)]=E\left[e^{-B}\cdot\frac{B^k}{k!}\right]$.

Then you just have to compute this expectation, given that B has an exponential distribution, and you're done. If you encounter any difficulty with this part, please post what you've tried and we'll help

#### Jason

##### New member
I decided to sleep on it, and now none of it makes sense. Should I be looking for something along the lines of:

$\displaystyle\sum_{k=0}^{\infty}e^{-B}\frac{B^k}{k!}$

#### Moo

##### New member
An exponential distribution is continuous. Its pdf is $\mu e^{-\mu b}$
So the expectation you're looking for is just $\displaystyle \int_0^\infty \mu e^{-\mu b}\cdot e^{-b}\cdot\frac{b^k}{k!} ~db$, where k is a constant.
If you didn't know this formula, I'll explain it later, I have to go sleep​

#### Jason

##### New member
Something like this?

$g(B)=e^{-B}\frac{B^k}{k!}$

$\Rightarrow E(g(B))=\displaystyle\int_{-\infty}^{\infty}g(b)f_B(b)db$

$=\displaystyle\int_{0}^{\infty}e^{-b}\frac{b^k}{k!}\mu e^{-\mu b}db$

$=\frac{\mu}{k!}\displaystyle\int_{0}^{\infty}b^ke^{-b(1+\mu)} db$

$=\frac{\mu}{k!}(0-(-1))=\frac{\mu}{k!}$

erm... ?

Last edited:

#### Moo

##### New member
Something like this?

$g(B)=e^{-B}\frac{B^k}{k!}$

$\Rightarrow E(g(B))=\displaystyle\int_{-\infty}^{\infty}g(b)f_B(b)db$

$=\displaystyle\int_{0}^{\infty}e^{-b}\frac{b^k}{k!}\mu e^{-\mu b}db$

$=\frac{\mu}{k!}\displaystyle\int_{0}^{\infty}b^ke^{-b(1+\mu)} db$

$=\frac{\mu}{k!}(0-(-1))=\frac{\mu}{k!}$

erm... ?
That's exactly it for the formula !

But your computation of the integral isn't correct.

Recall that k is a positive integer and that $\displaystyle k!=\Gamma(k+1)=\int_0^\infty e^{-t} t^k ~dt$

Make the proper substitution to get $e^{-b(1+\mu)}$ instead of $e^{-t}$ and it'll be all good ! I think it gives a geometric distribution, but I don't have time doing the whole computation (which shouldn't be too long by the way).

Good luck

#### Jason

##### New member
Gamma functions?! Haven't done this before...

$=\frac{\mu}{k!}\displaystyle\int_{0}^{\infty}b^ke ^{-(1+\mu)b} db$

$=\frac{u}{k!} \frac {\Gamma (k+1)}{(1+u)^{k+1}}$

$=\frac{u}{(1+u)^{k+1}}$

#### Moo

##### New member
Gamma functions?! Haven't done this before...

$=\frac{\mu}{k!}\displaystyle\int_{0}^{\infty}b^ke ^{-(1+\mu)b} db$

$=\frac{u}{k!} \frac {\Gamma (k+1)}{(1+u)^{k+1}}$

$=\frac{u}{(1+u)^{k+1}}$

Well if you want to compute it without mentioning gamma function, it's possible, but you'd have to do successive integrations by parts.
But this is indeed the solution.

And you'd recognize a geometric distribution because : $\displaystyle \frac{\mu}{(1+\mu)^{k+1}}=\frac{\mu}{1+\mu}\cdot \left(1-\frac{\mu}{1+\mu}\right)^k$

#### Jason

##### New member
Oh, so at least it's right then (I hate integration by parts).