# A problem about expectation of partial sum of random variables

Let $X_1, X_2,\dots,X_n$ be $n$ i.i.d. geometric distributed random variables with successful probability $p$, that is $$P(X_i=k)=(1-p)^{k-1}p$$

Let $Y_i=X_i-\mathbb{E}(X_i) = X_i-\frac{1}{p}$, so $Y_1,\dots,Y_n$ are also i.i.d. random variables.

Let $S_k=Y_1+\dots+Y_k$, and $S_k^+=\max(0,S_k)$

I want to know a close form of $\mathbb{E}(S_k^+)$

-

Let $X$ denote a discrete random variable with finite mean $\mu$. From $$E[X-\mu] = 0 = \sum_i (u_i - \mu) p_X(u_i) = \sum_{i\colon u_i > \mu} (u_i - \mu) p_X(u_i) + \sum_{i\colon u_i < \mu} (u_i - \mu) p_X(u_i),$$ we get that $$\sum_{i\colon u_i > \mu} (u_i - \mu)p_X(u_i) = \sum_{i\colon u_i < \mu} (\mu - u_i) p_X(u_i)$$ and so if $Y = \max\{0, X-\mu\}$, we have that \begin{align*} E[Y] &= \sum_i \max\{0, u_i - \mu\} p_X(u_i)\\ &= \sum_{i\colon u_i > \mu} (u_i - \mu)p_X(u_i)\\ &= \sum_{i\colon u_i < \mu} (\mu - u_i) p_X(u_i). \end{align*} In the question under consideration, $X = \sum_{j=1}^k X_j$ is a negative binomial random variable with parameters $(k,p)$ and mean $\frac{k}{p}$. Its pmf is given by $$p_X(n) = \binom{n - 1}{k-1} p^k (1 - p)^{n-k}, ~~ n = k, k+1, k+2, \ldots$$ Hence, \begin{align*} E[S_k^+] &= E\left[\max\left\{0, X-\frac{k}{p}\right\}\right]\\ &= \sum_{n = \lceil \frac{k}{p}\rceil}^\infty \left(n - \frac{k}{p}\right)\binom{n - 1}{k-1} p^k (1 - p)^{n-k}\\ &= \sum_{n = k}^{\lfloor \frac{k}{p}\rfloor} \left(\frac{k}{p}- n \right)\binom{n - 1}{k-1} p^k (1 - p)^{n-k}. \end{align*} If $k/p$ is an integer, one of the terms in each sum is $0$. The first form of the answer has already been given by @Alen but the second might be easier to evaluate numerically since it is a finite sum.

Neither form gives the floor of the expected value as has been alleged by OP Fan Zhang in comments on the main question.

-

Since $\sum\limits_{i = 1}^k {{X_i}}$ has negative binomial distribution with parameters $k$ and $1-p$, we have $$\mathbb{E}\left[ {S_k^ + } \right] = \sum\limits_{j = \left\lceil {\frac{k} {p}} \right\rceil }^\infty {\left( {j - \frac{k} {p}} \right)\left( \begin{gathered} j + k - 1 \\ j \\ \end{gathered} \right){p^k}{{\left( {1 - p} \right)}^j}}$$

-
This disregards jensen's inequality, and you can calculate it easier/to a number. –  gnometorule Jan 8 '12 at 14:57
...or not to the 'easier' part. My bad. It still seems to disregard jensen's inequality. –  gnometorule Jan 8 '12 at 15:09
@gnometorule: What are you talking about? –  Did Jan 8 '12 at 15:14
Is $\mathbb{E}\left[ {S_k^ + } \right] = \mathbb{E}[S_k^+]$? –  Fan Zhang Jan 8 '12 at 16:22