# Bayesian: Exponential Prior and Poisson Likelihood: Posterior Calculation

I am needing assistance in a particular question and need confirmation of my understanding.

The belief is that absences in a company follow a Poisson(λ) distribution.

It is believed additionally that 75% of thes value of λ is less than 5 therefore it is decided that a exponential distribution will be prior for λ. You take a random sample of 50 students and find out the number of absences that each has had over the past semester.

The data summarised below, note than 0 and 1 are binned collectively.

Number of absences

≤ 1 2 3 4 5 6 7 8 9 10

Frequency

18 13 8 3 4 3 0 0 0 1

Therefore in order to calculate a posterior distribution, My understanding is that prior x Likelihood which is this case is a Exponential(1/2.56) and a Poisson with the belief incorporated that the probability of less than 5 is 0.75 which is solved using

-ln(1-0.75)/(1/2.56)= 3.5489.

Furthermore a similar thread has calculated the Posterior to be that of a Gamma (sum(xi)+1,n+lambda)

Therefore with those assumptions, I have some code to visualise this

x=seq(from=0, to=10, by= 1)
plot(x,dexp(x,rate = 0.390625),type="l",col="red")
lines(x,dpois(x,3.54890),col="blue")
lines(x,dgamma(x,128+1,50+3.54890),col="green")



Any help or clarification surround this would be greatly appreciated

• The question was to clarify the posterior calculation in order to derive an algorithm to estimate the posterior distribution of λ Nov 27, 2020 at 15:33

If the prior$$\lambda\sim\mathcal E(\alpha)$$is such that$$\mathbb \pi(\lambda\le 5)=\frac{3}{4}$$then$$\mathbb \pi(\lambda\ge 5)=e^{-5\alpha}=\frac{1}{4}$$implies that$$\alpha=-\log(4)/5$$approximately equal to $$0.2773$$.
The likelihood is given by$$\mathbb P_\lambda(X_i\le 1)^{18}\prod_{j=2}^{10}\mathbb P_\lambda(X_i=j)^{n_j}=e^{-50\lambda}(1+\lambda)^{18}\underbrace{\prod_{j=2}^{10}\lambda^{jn_j}}_{\lambda^{\sum_{j\ge 2}jn_j}}=e^{-50\lambda}(1+\lambda)^{18}\lambda^{110}$$
The posterior$$\pi(\lambda|\mathbf x)\propto e^{-(\alpha+50)\lambda}(1+\lambda)^{18}\lambda^{110}$$is therefore a convex combination of 19 Gamma distributions (when expanding the $$(1+\lambda)^{18}$$ term).