Context
(Major edits) I am dealing with an expected value problem for a function
$$ g_s(D)=\textrm{max}\left\{0,D-y\right\} $$
of a discrete random variable $D$, where $y$ is a given (integer) scalar and $D$ follows a Negative Binomial distribution with known probability mass function (p.m.f):
$$ \begin{align} D \approx \textrm{Neg.Bin.}(\gamma,\alpha)\equiv\textrm{Pr}(D=d) &=\frac{(d+\gamma-1)!}{d!(\gamma-1)!}\alpha^d(1-\alpha)^\gamma \\ &=f_\gamma(d) \end{align} $$
For reasons that will become clearer later, I have highlighted the parameter $\gamma$ in the concise notation $f_{\gamma}(\cdot)$ for the p.m.f.; and will denote the corresponding Cumulative Density Function (CDF) as $F_\gamma(y)=\sum_{d=0}^y f_{\gamma}(d)$.
The expression of interest is the expected value of $g_s(D)$:
$$ E\left[g_s(D)\right]=\sum_{d=y+1}^\infty(d-y)f_\gamma(d) \tag{1}\label{lossfun} $$
Eq.\eqref{lossfun} is commonly referred to as "loss function" in the context of inventory control. (The sum in Eq.\eqref{lossfun} starts at $y+1$ because the case $y - D \geq 0$ is accounted for in a complementary expression for the "overage" or excess inventory, which I do not consider here).
Issue
I seem unable to obtain a correct expression for Eq.\eqref{lossfun} "from scratch" which can be reconciled with the solutions provided by the following references (both of which omit the detailed derivation):
- Alternative 1: Eq. 36 in this reference suggests the following solution: $$ E\left[g_s(D)\right]=E[D]\left[1-F_{\gamma+1}(y-2)\right]-y\left[1-F_\gamma(y-1)\right]$$
- Alternative 2: This other reference (Section C.2.3.6, p.452) gives the following expression, which is also mentioned in a different post: $$ E\left[g_s(D)\right]=-\left(y-\gamma\frac{\alpha}{1-\alpha}\right) \left[1-F_\gamma(y)\right]+(y+\gamma)\frac{\alpha}{1-\alpha}f_\gamma(y) $$
My derivation is shown next. Grateful for any help in understanding what's wrong with it, if anything (especially compared with Alternative 2)
Detailed derivation of loss function
Below, I develop Eq.\eqref{lossfun} to the best of my understanding:
$$\begin{align} E\left[g_s(D)\right] &= \sum_{d=y+1}^\infty df_\gamma(d)- y\sum_{d=y+1}^\infty f_\gamma(d) \tag{2}\label{e2}\\ &= \sum_{d=0}^\infty d\frac{(d+\gamma-1)!}{d!(\gamma-1)!}\alpha^{d}(1-\alpha)^\gamma - \sum_{d=1}^{y} d\frac{(d+\gamma-1)!}{d(d-1)!}\frac{\gamma}{\gamma!}\alpha\alpha^{d-1}(1-\alpha)^\gamma - y\left[1-F_\gamma(y)\right] \tag{3}\label{e3}\\ &= E\left[D\right] - \gamma\alpha \sum_{d=1}^y \frac{(d+\gamma-1)!}{(d-1)!\gamma!}\alpha^{d-1}(1-\alpha)^\gamma - y\left[1-F_\gamma(y)\right] \tag{4}\label{e4}\\ & = E\left[D\right] - E\left[D\right](1-\alpha)\sum_{z=\gamma}^{y+\gamma-1}\frac{z!}{(z-\gamma)!\gamma!}\alpha^{z-\gamma}(1-\alpha)^\gamma - y\left[1-F_\gamma(y)\right] \tag{5}\label{e5}\\ & = E\left[D\right]\left\{1-\sum_{z=\gamma+1}^{y+\gamma}\frac{(z-1)!}{\left[z-(\gamma+1)\right]!\gamma!}\alpha^{z-(\gamma+1)}(1-\alpha)^{\gamma+1}\right\}- y\left[1-F_\gamma(y)\right] \tag{6}\label{e6} \\ & = E\left[D\right]\left\{1-\sum_{z=\theta}^{y+\theta-1}\frac{(z-1)!}{(z-\theta)!(\theta-1)!}\alpha^{z-\theta}(1-\alpha)^{\theta}\right\}- y\left[1-F_\gamma(y)\right] \tag{7}\label{e7} \\ & = E\left[D\right]\left\{1-\sum_{d=0}^{y-1}\binom{d+\theta-1}{\theta-1}\alpha^{d}(1-\alpha)^{\theta}\right\}-y\left[1-F_\gamma(y)\right] \tag{8}\label{e8}\\ & = E\left[D\right]\left\{1-F_{\gamma+1}(y-1)\right\}-y\left[1-F_\gamma(y)\right] \tag{9}\label{e9} \end{align}$$
where $F_{\gamma+1}(\cdot)$ denotes the CDF of the Negative Binomial distribution having parameter $\gamma+1$.
More details on each step:
- Eq.\eqref{e3}: the first sum is split as described here; also, $\sum_{d=y+1}^\infty f_\gamma(d)=1-F_\gamma(y)$ is the complementary CDF.
- Eq.\eqref{e5}: I leverage the fact that the mean of the distribution can be expressed as $\frac{\gamma\alpha}{1-\alpha}$. Also, I make the substitution $z=d+\gamma-1$, after this example
- Eq.\eqref{e6}: The sum index is shifted as described here
- Eq.\eqref{e7}: I make the substitution $\theta=\gamma+1$
- Eq.\eqref{e8}: I make the substitution $d = z-\theta$, after this example. This is meant to save space: in reality I should set $t=z-\theta=d-2$ and then apply the index shift rule again (add $-2$ to each bound), which yields the same result.
Next I compare my result with the selected references.
Comparative insights
My stab at a obtaining an expression for Eq.\eqref{lossfun} "from scratch" fails to replicate either reference exactly.
- Eq.\eqref{e9} is comparable with, but not identical to Eq. 36 in this reference. However, I am satisfied I can see how Alternative 1 comes about, also thanks to personal communications with the author of the paper cited (this post has been refined several times in the absence of an answer).
- I am genuinely struggling to reconcile my result with the second (quite authoritative) source, Their equation is not directly comparable with Eq.\eqref{e9}, and features one neat parameterisation of the p.m.f.- not two. This issue is discussed next.
To ease comparison with Eq.\eqref{e9} I further develop the expression in Alternative 2 as follows: $$ \begin{align} E\left[g_s(D)\right] &= -\left(y-\gamma\frac{\alpha}{1-\alpha}\right)\left[1-F_\gamma(y)\right]+(y+\gamma)\frac{\alpha}{1-\alpha}f_\gamma(y) \\ & = -\left(y-E\left[D\right]\right)\left[1-F_\gamma(y)\right]+\left[y\frac{\alpha}{1-\alpha}f_\gamma(y)+E[D]f_\gamma(y)\right] \\ &=E\left[D\right]\left\{1-\left[F_\gamma(y)-f_\gamma(y)\right]\right\}-y\left[1-F_\gamma(y)\right]+\frac{E\left[D\right]}{\gamma}yf_\gamma(y) \\ & = E\left[D\right]\left\{ 1 - \left[F_\gamma(y-1)-\frac{yf_\gamma(y)}{\gamma}\right]\right\}-y\left[1-F_\gamma(y-1)\right] \end{align} $$
Unless I have made a mistake somewhere, comparing the above with Eq.\eqref{e9} might suggest that: $$ F_{\gamma+1}(y-1)=\left[F_\gamma(y-1)-\frac{yf_\gamma(y)}{\gamma}\right] $$
which doesn't seem correct since:
$$ \begin{align} F_{\gamma+1}(y-1) & = \sum_{d=0}^{y-1}\binom{d+\theta-1}{\theta-1}\alpha^d(1-\alpha)^{\theta} \\ & = \sum_{d=0}^{y-1}\frac{(d+(\gamma+1)-1)!}{d!(\gamma+1)-1)!}\alpha^d(1-\alpha)^{\gamma+1} \\ & = \frac{1-\alpha}{\alpha}\sum_{d=0}^{y-1}\frac{(d+1)\left((d+1)+\gamma-1\right)!}{\gamma(d+1)!(\gamma-1)!}\alpha^{d+1}(1-\alpha)^{\gamma} \\ & = \frac{1-\alpha}{\gamma\alpha}\sum_{d=0}^{y-1}(d+1)f_\gamma(d+1) \\ & =\frac{1-\alpha}{\gamma}\sum_{d=0}^{y-1}(d+\gamma)f_\gamma(d) \\ & = (1-\alpha)\left[F_\gamma(y-1)+\frac{1}{\gamma}\sum_{d=0}^{y-1}df_\gamma(d)\right] \\ & =(1-\alpha)\left[F_\gamma(y-1)-\frac{yf_\gamma(y)}{\gamma}+\frac{1}{\gamma}\sum_{d=0}^{y}df_\gamma(d)\right] \end{align} $$
This is as far as I get, but would be nice to be able to reconcile the last result, or at least figure out what I am doing wrong.