# Set of Poisson distributions given a Gamma distribution

I am struggling with this problem:

Let $Y \sim gamma(k, \theta)$ with $k\in \mathbb{N}$, that is $Y$ is a continuous random variable with density

$f(x) = \frac{\theta^k }{(k-1)!} x^{k-1} e^{-\theta x}$

Given $Y$, let $X_1, \dots , X_n \sim Poiss(Y)$ be independent and identically distributed random variables. Find the distirbution of $Y$ given $X_1, \dots , X_n$.

I belive that means that if we have $Y = \lambda$ then $f_{X_1, \dots , X_n |Y}(k_1, \dots, k_n) = \prod_i \frac{\lambda^k_i}{k_i!} e^{-\lambda}$ . Correct?

How do I find $f_{Y | X_1, \dots , X_n}$ ?

Your first step is correct, namely that

$$f_{X_1,\dots,X_n|Y=y}(x_1,\dots,x_n)=\prod_{i=1}^n\frac{e^{-y}y^{x_i}}{x_i!}$$

Then, apply Bayes' Theorem. In the discrete case, Bayes' Theorem reads

$$\Bbb P(A|B) \Bbb P (B)=\Bbb P(B|A) \Bbb P (A)$$

In the continuous case as we have now, this simply becomes

$$f_{Y|X=x}(y)f_X(x)=f_{X|Y=y}(x)f_Y(y)$$

Thus, applying it to the problem at hand, we get

$$f_{Y|X_1=x_1,\dots ,X_n=x_n}(y)=\frac{f_{X_1,\dots , X_n|Y=y}(x_1,\dots ,x_n)f_Y(y)}{f_{X_1,\dots ,X_n}(x_1,\dots ,x_n)}$$

Now, we know how to calculate the numerator on the RHS, but the problem is the denominator - we do not know the joint distribution of $X_1,\dots,X_n$ without being given information about $Y$.

But, observe that the object $f_{Y|X_1=x_1,\dots ,X_n=x_n}(y)$ we are trying to compute is a function of ONLY $y$ and is a probability density function. $f_{X_1,\dots ,X_n}(x_1,\dots ,x_n)$ is independent of $y$. Thus, we can compute this thing in proportionality, and the normalize at the end to obtain a PDF. So

\begin{align} \ f_{Y|X_1=x_1,\dots ,X_n=x_n}(y) & =\frac{f_{X_1,\dots , X_n|Y=y}(x_1,\dots ,x_n)f_Y(y)}{f_{X_1,\dots ,X_n}(x_1,\dots ,x_n)} \\ \ & \propto f_{X_1,\dots , X_n|Y=y}(x_1,\dots ,x_n)f_Y(y) \\ \ & = \biggl( \prod_{i=1}^n\frac{e^{-y}y^{x_i}}{x_i!} \biggl )\biggl (\frac{\theta ^ k}{(k-1)!}y^{k-1}e^{-\theta y} \biggl) \\ \ & \propto \biggl( \prod_{i=1}^n e^{-y}y^{x_i} \biggl )\biggl (y^{k-1}e^{-\theta y} \biggl) \\ \ & = y^{\sum_{i=1}^n x_i+k-1}e^{-(n+\theta)y} \end{align}

Observe that this is the PDF for a Gamma$\bigl(\sum_{i=1}^n x_i+k \;,\;n+\theta \bigl)$ distribution, so in normalizing, we get

$$f_{Y|X_1=x_1,\dots ,X_n=x_n}(y) = \frac{(n+\theta)^{\sum_{i=1}^n x_i+k}}{\Gamma \bigl(\sum_{i=1}^n x_i+k \bigl)}y^{\sum_{i=1}^n x_i+k-1}e^{-(n+\theta)y}$$