2
$\begingroup$

I am analyzing daily data transaction data.

I am assuming that

  • The number of transactions in every day of length t has the Poisson distribution with mean λt
  • The number of transactions in evert collection of disjoint days are independent

Xi = {number of transactions on day i}
And thus, X~Poisson(λ) where λ is the mean number conversions per day.

I want to take a Bayesian approach - specifically, as I get more days of data, I want to update λ with the conjugate prior distribution to the Poisson, Gamma.

What are the parameters of this Gamma distribution and how do they relate to the Poisson process?

$\endgroup$

2 Answers 2

10
$\begingroup$

Your prior is $\lambda\sim\mathcal G(a, b)$, i.e. $$\pi(\lambda)\propto \lambda^{a-1}e^{-b\lambda}.$$

To get the posterior, multiply the prior by the likelihood:

$$\begin{eqnarray} \pi\left(\lambda|X_1,\ldots,X_n\right) &\propto& \lambda^{a-1}e^{-b\lambda} \prod_{i=1}^n e^{-\lambda}\frac{\lambda^{X_i}}{X_i!} \\ &\propto& \lambda^{a-1}e^{-b\lambda} e^{-n\lambda}\lambda^{\sum X_i}\\ & \propto&\lambda^{a+\sum X_i -1} e^{-\lambda(b+n)} \end{eqnarray}$$

and so the posterior is $\lambda|X_1,\ldots, X_n \sim \mathcal G\left(a+\sum X_i, b+n\right)$.

$\endgroup$
2
  • $\begingroup$ is there anyway, that $\mathcal G\left(a+\sum X_i, b+n\right)$ can be persented as this $\mathcal G\left(a+\sum X_i, b/(nb+1)\right)$, because I have been asked a question in an assignment about this, and I can only get the posterior you get. $\endgroup$
    – Bucephalus
    Sep 23, 2018 at 11:19
  • 3
    $\begingroup$ My answer uses the shape-rate parameterization for the gamma distribution. If you use the shape-scale parameterization, your formula is correct. $\endgroup$ Sep 23, 2018 at 17:10
1
$\begingroup$

The answer by @RobynRyder is great, +1. Just wanted to generalize it a bit and add some interpretation.

Imagine we observe $X_i$ events from the Poisson process in time $t_i$ for observation $i$. The equations in his answer get modified slightly:

$$\begin{eqnarray} \pi\left(\lambda|X_1,\ldots,X_n\right) &\propto& \lambda^{a-1}e^{-b\lambda} \prod_{i=1}^n e^{-\lambda t_i}\frac{(\lambda t_i)^{X_i}}{X_i!} \\ &\propto& \lambda^{a-1}e^{-b\lambda} e^{-\lambda \sum t_i}\lambda^{\sum X_i}\\ & \propto&\lambda^{a+\sum X_i -1} e^{-\lambda(b+\sum t_i)} \end{eqnarray}$$

and so the posterior is $\lambda|X_1,\ldots, X_n \sim \mathcal G\left(a+\sum X_i, b+\sum t_i\right)$.

This is equivalent to saying that we say $\sum X_i$ more events in a total observation period of $\sum t_i$. So, both the number of events, $a$ and total observation time, $b$ need to be updated.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.