An insurance company supposes that the number of accidents that each of its policyholders will have in a year is Poisson distributed, with the mean of the Poisson depending on the policyholder. If the Poisson mean of a randomly chosen policyholder has a gamma distribution with density function
g(\lambda)=\lambda e^{-\lambda},\quad\lambda\geqslant0what is the probability that a randomly chosen policyholder has exactly n accidents next year?
Let X denote the number of accidents that a randomly chosen policyholder has next year. Letting Y be the Poisson mean number of accidents for this policyholder, then conditioning on Y yields
P\{X=n\}=\int_{0}^{\infty}P\{X=n|Y=\lambda\}g(\lambda)\,d\lambda=\int_{0}^{\infty}e^{-{\lambda}}\frac{\lambda^{n}}{n!}\lambda e^{-{\lambda}}\,d\lambda
={\frac{1}{n!}}\int_{0}^{\infty}\lambda^{n+1}e^{-2\lambda}\,d\lambda
However, because
h(\lambda)=\frac{2e^{-2\lambda}(2\lambda)^{n+1}}{(n+1)!},\quad\lambda\gt 0is the density function of a gamma (n + 2, 2) random variable, its integral is 1. Therefore,
1=\int_{0}^{\infty}{\frac{2e^{-2\lambda}(2\lambda)^{n+1}}{(n+1)!}}\,d\lambda={\frac{2^{n+2}}{(n+1)!}}\int_{0}^{\infty}\!\!\!\lambda^{n+1}e^{-2\lambda}\,d\lambdashowing that
P\{X=n\}={\frac{n+1}{2^{n+2}}}