# Application Problem of Expected Value of Posterior Distribution

I am trying to understand the following:

Suppose that the number of people who visit the grocery store on any given day is Poisson($\lambda$) and the parameter of the Poisson distributed has a $\Gamma(3,15)$ distribution. On Monday 62 people visited the grocery store. Derive the posterior distribution $P(\Lambda\mid\vec{X}=\vec{x})$, where $\vec{X}=(X_1,X_2,\ldots,X_n)$ and $\vec{x}$ is an observed sample from the distribution of $X$. Then compute the posterior mean using the information provided. Note the sum of iid Poisson r.v. is also Poisson.

I computed the posterior distribution for a general poisson parameter with $\Gamma(a,b)$. I found this to be $\Gamma\left(a+n,1+\frac{1}{b}\right).$ Note, the shape and scale parameterization of $\Gamma$ was used. I don't understand Why I need the fact that the sum of iid poisson r.v.'s is also poisson. Can't I just substitute $a=3$, $b=15$, $n=62$ into my posterior mean formula?

For a Poisson likelihood, the gamma distribution is a conjugate prior, so the posterior is also gamma, as you have found. This lets you calculate the posterior in two different ways: one is to compute $f_{\Lambda}(\lambda \mid x)$ for a single observation, recognize this as gamma with updated hyperparameters, and then use an inductive argument to get $f_{\Lambda}(\lambda \mid \boldsymbol x)$ for $\boldsymbol x = (x_1, x_2, \ldots, x_n)$ for any number of observations. Alternatively, you could note that $n \bar x = \sum x = x_1 + x_2 + \cdots + x_n$ is itself Poisson with parameter $n \lambda$, hence the posterior for $\lambda$ satisfies $$f_{\Lambda}(\lambda \mid n\bar x) = f_{\Lambda}(\lambda \mid \boldsymbol x).$$ Explicitly, $$f_{\Lambda}(\lambda \mid x) \propto \Pr[X = x \mid \lambda] f_{\Lambda}(\lambda) = e^{-\lambda} \frac{\lambda^x}{x!} \frac{b^a \lambda^{a-1} e^{-b \lambda}}{\Gamma(a)} \propto \lambda^{a+x-1} e^{-(b+1)\lambda},$$ which is clearly proportional to a gamma density with shape $a^* = a+x$ and rate $b^* = b+1$; thus for $n$ iid observations, we can extend this to get $$f_{\Lambda}(\lambda \mid \boldsymbol x) \propto \lambda^{a + \sum x - 1} e^{-(b+n) \lambda},$$ or $$\Lambda \mid \boldsymbol x \sim \operatorname{Gamma}(a + n\bar x, b + n).$$ But we could have also gotten this by writing $$f_{\Lambda}(\lambda \mid n\bar x) \propto \Pr[{\textstyle\sum} X = n\bar x \mid \lambda]f_\Lambda(\lambda) = e^{-n \lambda} \frac{(n \lambda)^{n \bar x}}{(n \bar x)!} \frac{b^a \lambda^{a-1} e^{-b \lambda}}{\Gamma(a)} \propto \lambda^{a + n\bar x - 1} e^{-(b+n)\lambda}.$$ The result is the same.
• So $n$ in my case is the number of observations, which is 62. Just seems kind of weird that the mean of the posterior is then $(a+n\vec{x})*(b+n)$, because that number is a lot larger than the observed sample... Jun 15 '15 at 12:51
• No. $n$ is the number of days you recorded; because the Poisson rate parameter represents the mean number of customers arriving per day. So if you observe $x = 62$ customers arriving in $n = 1$ day, that is a single observation with $\bar x = 62$ (the sample mean of one observation is simply that observation), and $n = 1$. Jun 15 '15 at 13:52
• Be careful to distinguish the sample mean $\bar x$ and the vector of observations $\boldsymbol x = (x_1, \ldots, x_n)$. Where I use a bar atop $x$, I refer to the sample mean. Where I use boldface, I refer to the vector of observations. Also, you are asked to compute the general case of the posterior distribution if you were to observe the arrival of $x_1$ customers on day 1, $x_2$ on day 2, etc., until $x_n$ customers on day $n$, but you were only asked to use this formula for $n = 1$. Jun 15 '15 at 13:56