# 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.

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}

• @Vincert Dear Vincent, many thanks for your description. I understood your approach and its correct. Actually the waiting time of the first arrival, I modeled it and the answers matching with simulations. I would like to discuss how I am doing. Actually the first arrival either waits for $T_{max}$ if we could not receive sufficient arrivals in this duration, say $r$, or it will wait for $(r-1)/ \lambda$ times the CDF associated with the $r^{th}$ arrival. I used Erlang as it is just a case of gamma distribution when the stages are considers as integers, so we have $r-1$ stages. – Hallian1990 Feb 14 '17 at 3:53
• So what I did is here: for calculating expectation value of waiting time of first arrival: As the first arrival triggers the counter timer at t=0, and we need $r-1$ more arrivals to send before timer expiry. On the other hand, if we recieve less than $r-1$ arrivals, the first arrival waiting time would be offcourse $T_{max}$ (your approach also says the same thing I am happy with that). – Hallian1990 Feb 14 '17 at 3:54
• So, I computed prob. using the standard Poisson formula for $0 to 'r-2'$ and multiplied with $T_{max}$ and the last Probability of $r-1$ arrivals is calculated by subtracting all previous prob. for $0 to 'r-2'$ arrivals from 1, and multipled with Erlang(r-1,lambda) distribution i.e., $(r-1)/ \lambda$. The results match with my simulation. – Hallian1990 Feb 14 '17 at 3:54
• Now, I was thinking , I have the max. waiting time of the first arrival out of 'r' arrivals. As we know arrival time of packet following poisson is 1/lambda, so , I said the waiting time of the second arrival should be $1/\lambda$ less than the first arrival waiting time. But, this is not right as it works for higher lambda values when aggregation is done due to arrival of 'r' packets but for lower lambda values, it does not fit. I checked with simulator. – Hallian1990 Feb 14 '17 at 3:55
• E.g., if I use $T_{max}$ = 50ms, then for smaller lambda values, the waiting time of second arrival gives terrible values when I used this approach $E[X]_{2}=E[X]_{1}-1/\lambda$ as $1/\lambda$ values get larger than E[X]_{1}. I can put a bound condition with min(0, $1/\lambda$), it makes the waiting time of second also positive for lower lambda, but not gives good results. – Hallian1990 Feb 14 '17 at 3:55