Confusion regarding Poisson distribution conditioned on uniform distribution

1.7k Views Asked by At

From SOA Sample #307:

The number of workplace accidents occurring in a factory on any given day is Poisson distributed with mean $λ$ . The parameter $λ$ is a random variable that is determined by the level of activity in the factory and is uniformly distributed on the interval $[0,3]$. Calculate the probability of one accident on a given day.

Their solution starts:

$$P[X=k|λ]={{λ^ke^{-λ}}\over k!}$$

$$P[X=1]=\int_0^3 P[X=1|λ]f(λ)dλ=\int_0^3 P[X=k|1] {1 \over 3}dλ$$

I have two questions that may be the result of the same confusion:

  1. How does $P[X=k|λ]={{λ^ke^{-λ}}\over k!}$? What is the numerator of ${P[X=k] \cap P[λ=y]}\over P[λ=y]$, and what is the denominator to get the result they have?

  2. What is happening in the second step? I understand that they are trying to find the total probability of the uniform distribution of $λ$. I don't understand why they are multiplying by $f(λ)= {1\over 3}$. Does this mean the denominator of $P[X=k|λ]={{P[X=k] \cap P[λ=y]}\over P[λ=y]}$ is $f(λ) = {1\over 3}$? How does that show up in the first step?

3

There are 3 best solutions below

6
On BEST ANSWER

The formula $P(A|B)=P(AB)/P(B)$ does not work when $P(B)=0$. Here, the conditional probability has to be understood as a limit. For example, $$ P(X=k|\lambda=2)=\lim_{\epsilon\to 0} P(X=k|2-\epsilon<\lambda<2+\epsilon)=\lim_{\epsilon\to0} \frac{P(X=k\text{ and }2-\epsilon<\lambda<2+\epsilon)}{P(2-\epsilon<\lambda<2+\epsilon)} $$ The reason for the $1/3$ is because the pdf of a uniform random variable between $a$ and $b$ is $1/(b-a)$.

0
On

This is an issue one can face before learning some of the formal aspects of probability theory, especially to do with conditional probability. What this notation, $\mathbb{P}[X = k | \lambda]$ is saying, is, "the probability $X = k$ given the parameter $\lambda$". Let me introduce the letter $L$ to denote the random variable of the parameter. So by definition we have that,

$$(X \ | \ L = \lambda) \sim \text{Poisson}(\lambda) $$

$$L \sim \text{Uniform}(0,3) $$

So we are not using the definition of conditional probability in the first part at all, we are using the definition of the random variable $X$ conditioned on $L$ to obtain,

$$\mathbb{P}[X = k | L = \lambda] = \frac{\lambda^k e^{-\lambda}}{k!} $$

Now, for the second step, what they are using is a kind of law of total probability but for continuous distributions, this is formalised later when you learn the more theoretic foundations of probability theory, but for now you can simply look at it like this,

$$\mathbb{P}[X = k] = \int_{\mathbb{R}} \mathbb{P}[X = k | L = \lambda] f_L(\lambda) \ \mathrm{d} \lambda, \ \ (*)$$

Where $f_L(\lambda)$ is the density of $L$. Note first, how this is similar to the normal law of total probability, where we use an integral instead because we are dealing with a continuous distribution. Now, the reason why they have a $1/3$ there is because since $L \sim \text{Uniform}(0,3)$ the density is,

$$f_L(\lambda) = \begin{cases}\frac{1}{3}, \ \lambda \in (0,3) \\ 0, \ \text{otherwise} \end{cases} $$

Although you might think the density should be $1$ but remember that is for a $\text{Uniform}(0,1)$ distribution. The density must integrate to $1$ always, which is why we have a $1/3$ since we are now integrating over $(0,3)$. Using this density, we then have with $(*)$,

$$\mathbb{P}[X = k] = \int_{\mathbb{R}} \mathbb{P}[X = k | L = \lambda] f_L(\lambda) \ \mathrm{d} \lambda = \int_0^3\mathbb{P}[X = k | L = \lambda] \frac{1}{3} \ \mathrm{d}\lambda = \int_0^3 \frac{\lambda^k e^{-\lambda}}{3k!} \ \mathrm{d} \lambda $$

I will leave you to compute the integral, but just to sum up, this is simply a "continuous" version of the law of total probability.

0
On

If $X \sim \mathsf{Pois}(\lambda),$ then $P(X = 1) = \lambda e^{-\lambda}.$ Then $\Lambda \sim \mathsf{Unif}(0,1),$ implies the density function is $\lambda = \frac 13,$ for $0 < \lambda < 3.$

So you want $\int_0^3 \frac 13 \lambda e^{-\lambda}\,d\lambda.$ In more familiar notation, this is $\frac 13 \int_0^3 xe^{-x}\,dx,$ where the integrand can be recognized as the density function of the distribution $\mathsf{Gamma}(\text{shape} = 2, \text{rate}=1).$

So the numerical answer in R is 0.2669. [Of course, there are other ways to evaluate the integral.]

pgamma(3, 2, 1)/3
[1] 0.2669506

Also, by simulation in R the answer is 0.267, correct to about three places.

set.seed(1216)
p = replicate(10^6, dpois(1, runif(1,0,3)))
mean(p)
## 0.2668311      # aprx  0.26695
2*sd(p)/10^3
[1] 0.0001664155  # 95% margin of simulation error

Note: In a Bayesian framework we could say that the uniform distribution in the prior of the Poisson parameter $\lambda$ for this particular commercial application. More generally, one often uses gamma distributions as priors for problems with Poisson data.