# Distribution of total number of car accidents in a lifetime of the car

the number of car accidents every year has Poisson distribution with mean $\lambda$ and lifetime of the car has exponential distribution with mean $\frac{1}{\mu}$. how can find distribution total number of car accidents in a lifetime of the car?

The Poisson distirbution with rate $\lambda t$ gives the distribution of the number of events in a time interval of length $t$. So the conditional distribution for number of events in the lifetime of the car is Poisson with rate $\lambda t$ given the car's life is $t$. Multiply this by the exponetial density for the lifetime of $t$ and integrate over all $t$ to get the distribution.

This question has a pretty answer that requires almost no arithmetic.

Consider how you might simulate such data. A Poisson process of intensity $\lambda$ is simulated by generating the times elapsed between events, which are known to have exponential distributions of rate $1/\lambda$. Conversely, since the car's lifetime is exponential of rate $\mu$, the death of the car is a Poisson event with intensity $1/\mu$. Thus, we could use an Exponential$(1/\lambda)$ variate to simulate a Poisson$(\lambda)$ process to represent accidents, and independently simulate a Poisson$(\mu)$ process to represent the deaths of cars. Since these are independent, if we were to forget what type of event each is, we would have a realization of a Poisson$(1/(1/\lambda+1/\mu))$ process.

This figure uses exponentially distributed times with a mean of $14/9 = 1/(1/2+1/7)$ to simulate combined events from a Poisson$(1/2)$ process (for the accidents, which happen about once every two years) and a Poisson$(1/7)$ process (corresponding to an exponential lifetime of mean $7$ years).

We could recover the statistical properties of the original pair of processes by independently and randomly re-marking each of these generic events as a "death" with probability $\mu/(\mu+\lambda)$.

This figure could have been generated in either of two ways: (1) the previous points were marked as red bars, independently at random with a chance of $2/(2+7)$, or (2) by generating the blue dots as a Poisson$(1/2)$ process and, independently, the red dots as a Poisson$(1/7)$ process. The data it produces are the counts of accidents per car: that is, the lengths of the runs of blue dots, which begin $0, 4, 2, 1, 0, 3, 4+, \ldots$.

The question asks for the distribution of the total number of accidents that occur before the death of a car. From our second point of view--generate all events and then randomly label them as "accident" or "death"--the question becomes

What is the distribution of the total number of Bernoulli$(\mu/(\mu+\lambda))$ trials that occur before the first "success"?

By definition, this is a geometric distribution with parameter $\mu/(\mu+\lambda)$. The chance of any value $k=0, 1, 2, \ldots$ equals

$$\Pr(k) = \frac{\lambda\mu^k}{(\mu+\lambda)^{k+1}}.$$

The only calculation needed to pin down this distribution is the evaluation of its parameter.

• Having written this, I now notice that @Dilip Sarwate has posted a comment (to another answer) strongly hinting at the same solution.
– whuber
Commented Nov 20, 2014 at 16:15
• Thanks for noticing! I was planning on writing up the idea this evening but you beat me to the punch. Commented Nov 21, 2014 at 3:17

Denote the lifetime of car by $Y$, and the number of car accidents every year by $X$. Given the conditions above, suppose $f_X(x) = \frac{e^{-λ}λ^x}{x!}$, and $f_Y(y)=μe^{-μy}$. Suppose the number of car accidents in each year is $X_i$ for $1 \leq i\leq Y$, $X_i\overset{iid}{\sim} f_X(x)$, and $Z = \sum X_i$.

The moment generating function of $X_i$ is $M_{X_i}(t) = E(e^{tx}) = e^{-λ(1+e^t)}$, so $M_Z(t) = \prod M_{X_i}(t) = e^{-λY(1+e^t)}$. Thus, $Z|Y\sim Poi(λY)$, and $f_{Z|Y}(z|y)=\frac{e^{-λy}(λy)^z}{z!}$

Finally, the pdf of z, number of car accidents in a lifetime of the car, is $f_Z(z) = \int_0^\infty f_{Z,Y}(z,y)dy = \int_0^\infty f_{Z|Y}(z|y) f_Y(y)dy = μλ^z\int_0^\infty \frac{y^{(z+1)-1} e^{-(λ+μ)y}}{z!}dy = \frac{μλ^z}{(λ+μ)^{z+1}} \int_0^\infty \frac{y^{(z+1)-1} e^{-(λ+μ)y}}{\Gamma(z+1)(\frac{1}{λ+μ})^{z+1}}dy = \frac{μλ^z}{(λ+μ)^{z+1}}\int_0^\infty Gamma(y;\alpha =z+1, \beta=\frac{1}{λ+μ})dy = \frac{μλ^z}{(λ+μ)^{z+1}}$

And thank any commenter to point out derivation errors if there are.

Edit: Ignore the second and the third paragraphs and the last sentence of the first paragraph. Denote total number of car accidents in a lifetime of the car by $Z$, then $Z|Y\sim ~ Poi(λy)$ and $p(z|y) = \frac{e^{-λy}(λy)^z}{z!}$, and $p(z) = \int_0^\infty p(z|y) f_Y(y)dy = \frac{μλ^z}{(λ+μ)^{z+1}}$

• Well, the calculations are correct but the nomenclature is not. $Z$ is a discrete random variable and as such, does not have a pdf (probability density function) if one is distinguishing between pdf and pmf. If one is cavalierly ignoring such fine distinctions, then the final expression needs something to indicate that $z$ takes on integer values $0,1,2,\ldots$ only, and is not a real variable. Note that writing $$P\{Z=n\}=\left(\frac{\mu}{\lambda+\mu}\right)\left(\frac{\lambda}{\lambda+\mu}\right)^n=p(1-p)^n,~n=0,1,2,\ldots$$ might lead to additional insight into the answer. Commented Nov 20, 2014 at 13:07
• Thanks Dilip, I learned that the derivation is problematic. Is the last expression $p(z) = \int_0^\infty p(z|y) f_Y(y)dy$ fine? I cannot obtain the result if both Z and Y are discrete. I know $f_Z(z) = \int f_{Z,Y}(z, y)dy$ but don't know an interpretation or intermediate step between $p(z)$ and $\int_0^\infty p(z|y) f_Y(y)dy$ when z is discrete and y is continuous
– Tom
Commented Nov 20, 2014 at 14:17