# Math Help - 3 part Hierarchical Probability and Stats Question

1. ## 3 part Hierarchical Probability and Stats Question

Here's my problem:

Suppose we have a three-stage hierarchical model

Y|N~ Binomial(N,p), N|λ ~ Poisson(λ), λ ~ Gamma(a,b)

Find a marginal distribution for Y.

What I did was first find the pdf for f(N,λ) by multiplying f(N|λ) * f(λ).

Next step was to find a marginal probability for N. I integrated f(N,λ) with respect to λ from 0 to infinity which worked out somewhat nicely giving me the marginal distribution for N.

here's what I got: Γ(N+a) ((b/(b+1))^(N+a)/(N!b^aΓ(a)),
or, in a more easily looked at format, here

Now, I found f(N,Y) which is just f(N)*f(Y|N).

The problem arises when I try to obtain the marginal for Y. I've been looking for a pdf to help make this easier, but I can't see any that do any good.

Thanks for you help!

2. I would multiply all three orginal dsitributions then integrate out lambda and finally sum out the N.

3. Thanks for the advice-- I'll give that a try.

4. I gave it a try, and I'm still winding up with the same issue...

5. Maybe try MGFs.
I'm stuck on the last part, but try this

$M_Y(t)=E(E(E(e^{Yt})|N)|\lambda)$

$=E(E((q+pe^t)^N)|\lambda)$

let $q+pe^t=e^s$

$M_Y(t)=E(E(e^{sN}|\lambda))$

$=E(e^{\lambda (e^s-1)}) =E(e^{\lambda (q+pe^t-1)})$

$=E(e^{\lambda (pe^t-p)}) =E(e^{\lambda p(e^t-1)})$

Let $u=p(e^t-1)$

$=E(e^{\lambda u})=M_{\lambda}(u)$

Plug in your gamma MGF and see what you have.
I'm going to bed, it's after 2 AM.

6. hee hee- same here. For some reason I can't stop though! G'night.

7. I was stuck with that same nasty sum.
I wanted to claim it was a Poisson and the garbage in the sum was just a constant.
Because you can pull out the

$\left({p\over 1-p}\right)^y {1\over y!}$

which is two-thirds of a Poisson.

But this gamma seems odd.
Are you sure of that distribution?
The parameters a and b are annoying.

8. I double checked and, yes, the parameters are a&b. I got something that looked a lot like what you have too... I feel like it should turn into the poisson given the parameter of N but I don't know how to manipulate it. I will be going to the professor tomorrow for some help.

9. 1 Y is discrete
2 It support once N is gone is from 0 to infinity.
3 The sum looks like the Taylor Series for e, but that a and b mess it up.
That leads support to a Poisson, but I should recognize this MGF.

10. So apparently my professor said it's a negative binomial. I feel like that doesn't work though... the a's get in the way!

11. well, I figured that gamma was wrong
The neg binomial and gamma are quite different.
I figured it was some kind of exponential
now I need to know exactly how you write your neg binomial
You need to know if you're counting the trial in which the r{th} success occurs...

12. I honestly don't know if it includes rth trial. He said something to the effect that all my N's would get summed into 1 if I could set up the right negative binomial. So far, what I have is something to this effect:

1/(b^a*y*(a-1)!) * (b/(b+1))^a * Summation from n=0 to infinity [ (N+a-1)!p^y(1-p)^(N-y)* b^N /((y-1)!(N-y)! (b+1)^N)

This looks an awful lot like a negbin, but instead of (N+a-1)!, I need (N-1)! and I don't know what to do with (b/(b+1))^N.

13. I'm just about there: It just needs a bit of fine tuning, but I think I can make it look like I want it to. I'll try and post an answer tonight.

14. Blast! I'm stuck again. Is this a legal negbin?

15. Oh, I thought that intead of a gamma the distribution of lambda was a neg binominal.
You're saying that the final distribution is a neg bi, well thats possible and my MGF technique is close,
but I think there needs to be a relationship between b and p.
Here r is just a.