Negative-binomial sum of exponential claims (source code)

= Negative-binomial sum of exponential claims
{title2=$\mathcal L(T)=\mathcal L(\sum_{j=1}^B Y_j),\quad B\sim\operatorname{Bin}(n,q),\ Y_j\sim\operatorname{Exp}(p)$}

Let $n$ be a positive <integer>, let $0<p<1$, and put $q=1-p$ and let the original independent count have <negative binomial distribution> with <probability mass function> $\binom{n+k-1}{k}p^nq^k$ on $k\ge0$. With unit-rate <exponential distribution> severities, its <moment-generating function> is $[p+qp/(p-t)]^n$ for $t<p$. Thus it also has a <random sum of independent claims> representation with independent <binomial distribution> count $B$ and rate-$p$ <exponential distribution> steps. For $n=2$ the law is $p^2\delta_0+2pq\operatorname{Exp}(p)+q^2\operatorname{Erlang}(2,p)$. The <hurdle decomposition of a positive random sum> therefore has zero mass $p^2$ and positive density $p^2e^{-px}(2q+q^2x)/(1-p^2)$.

The positive-<integer> restriction on $n$ is essential for the finite <binomial distribution> representation. A <negative binomial distribution> also permits noninteger positive shape through its generalized <probability mass function>, but that broader model cannot be represented by a <binomial distribution> with a noninteger number of trials.