average time spent I want to find out the expectation values of individual waiting times of the Poisson arrivals with rate $\lambda$. Arrivals are served in groups e.g., service will be done when N arrivals or served based on expiry of counter timer with deterministic time value T. Can some one help me how to find the waiting time of the individual arrivals?
asssume waiting time of the first is $E[X]$, what is the waiting time of second, third, fourth,....
Thanks in advance.
 A: Let arrival be modeled by a poisson process $X=(X_t)_{t\in\mathbb{R}_{\geq0}}$ with rate $\lambda$. $X$ has independent increments and the waiting time between event(arrivals) is exponentially distributed with parameters $\lambda$.
Let arrivals be served in chunks of $n$, i.e. service is halted until $n$ are waiting or the time passed from first arrival in the chunk is $T$ at that point everybody waiting will be served at once. 
Denote by $X_1$ the waiting time of the first arrival in the batch and similarly $X_2,\dots,X_n$ the waiting times of the following arrivals.
The waiting time can be expressed in the following way ($J_i,\;i=1\dots,n$ are i.i.d. exponentially distributed random varibales with parameter $\lambda$ ):
\begin{equation}
X_1\overset{d}{=}\min\left(\sum_{i=2}^nJ_i, T \right),
\end{equation}
which follows since the first has to wait for $n-1$ more arrivals or until $T$-time has passed (together with the properties of the Poisson Process). Analoguously, we get for the other arrivals,
\begin{eqnarray}
X_j&\overset{d}{=}&\max\left(X_{j-1}- J_j,0\right)
\\&\overset{d}{=}&\max\left(\min\left(\sum_{i=j+1}^n J_i,T-\sum_{i=2}^j J_i\right),0\right)
\end{eqnarray}
for $j=2,\dots,I$ and $I=\inf\{i\vert X_i=0\}$. It makes only sense to consider the waiting times of the arrivals until index $I$ because after this index all waiting will be served and the next arrival has waiting time equal (in law) to $X_1$.
Now we can compute the expected waiting time of arrival $i$ but first recall that the sum of i.i.d. exponential Random variables is a gamma distributed random variable. In our case this gives $\sum_{i=j+1}^n J_i \sim\Gamma(n-j,\lambda)$ :
\begin{eqnarray}
E[X_1]&=&E\left[\min\left(\sum_{i=2}^nJ_i, T \right)\right]
\\
&=&E\left[\min(\Gamma(n-1,\lambda),T)\right]
\\
&=&\int_0^T x \cdot \frac{\lambda^n-1}{\Gamma(n-1)} x^{n-1} e^{-\lambda x} dx
\end{eqnarray}
evaluating this integral will give you an expression involving the incomplete gamma function.
\begin{eqnarray}
E[X_j]&=&E\left[\min\left\{\Gamma(n-j,\lambda),\max(T-\Gamma(j-1,\lambda),0)\right\}\right]
\end{eqnarray}
where $\Gamma(n-j,\lambda)$ and $\Gamma(j-1,\lambda)$ are independent gamma distributed random variables, hence this expectation can be computed by conditioning on $\Gamma(n-j,\lambda)$ and then integrating ..
\begin{eqnarray}
E[X_j]=\int_0^T \frac{\lambda^{j-1}}{\Gamma(j-1)} x_2^{j-1}e^{-\lambda x_2}\int_0 ^{T-x_2}x_1 \frac{\lambda^{n-j}}{\Gamma(n-j)}x^{n-j} e^{-\lambda x_1} dx_1 dx_2,\quad j=2,\dots,I.
\end{eqnarray}
