6
$\begingroup$

You are invited to a party. Suppose the times at which invitees arrives are independent uniform(0,1) random variables. Suppose that aside from yourself the number of other people who are invited is a Poisson random variable with mean 10.

I want to find out

  1. The expected number of people who arrive before you
  2. The probability that you are the nth person to arrive

Answer:

  1. Let X be the number of people who arrive before you.Because you are equally likely to be the first,second,or third,...,or nth arrival. P{X=I}=$\frac1n\displaystyle\sum^n_1 i =\frac{n(n+1)}{2n}, i =0,...,n$ Therefore

    E[X]=$\frac{n+1}{2}$ and

  2. P{X=n}=$\frac{e^{-10}10^n}{n!}$

Are these answers correct? The author has not provided the correct answers.

$\endgroup$
  • 4
    $\begingroup$ It is hard to see how those answers could be correct, because (1) is in terms of some expression "$n$" which is neither defined nor given in the problem itself and (2) is obviously too large. To check (1), note that the expected number of people arriving after you must equal the expected number of people arriving before you and that the sum of those is the expected number of people (besides yourself), which the problem states is equal to $10$. Therefore the answer must be $10/2=5$. For (2), use the hint you provided in your tags: these are conditional-probability problems. $\endgroup$ – whuber Aug 17 '16 at 15:45
  • $\begingroup$ @whuber That is a great approach. If you post this as an answer and that is accepted, everybody will find an read it in the future. Please don't 'hide' the best answer in a comment. Thanks! $\endgroup$ – Bernhard Jun 23 '17 at 14:29
  • $\begingroup$ @Bernhard Thank you for the encouragement. I posted that as a comment because I hadn't offered any answer to #2. Since there is a relatively simple solution requiring almost no algebraic manipulation, and a simple answer was still lacking in this thread, I have fleshed that out and posted it. $\endgroup$ – whuber Jun 23 '17 at 19:10
2
$\begingroup$

To check (1), note that the expected number of people arriving after you must equal the expected number of people arriving before you and that the sum of those is the expected number of people (besides yourself), which the problem states is equal to 10. Therefore the answer must be $10/2=5$.

For (2), use the hint you provided in your tags: these are conditional-probability problems. Thus, we partition the event "I am the $n^\text{th}$ person to arrive" into the disjoint events

  • "I am at position $n$" and "$k-1=n-1$ people arrive with me",
  • "I am at position $n$" and "$k-1=n$ people arrive with me",
  • "I am at position $n$" and "$k-1=n+1$ people arrive with me", etc,

with $k=n, n+1, n+2, \ldots$. Each of those events "$k-1$ people arrive with me" occurs with the Poisson probability associated with $k-1$. Conditional on $k-1$, the chance that I am in position $n$ is the same as the chance that anyone else is in that position, which therefore must be $1/k$ when there are $k-1$ people plus myself.

In terms of $\lambda=10$ and letting $X$ be a Poisson$(\lambda)$ variable with distribution function $F_\lambda$, the answer therefore is

$$\sum_{k=n}^\infty \frac{1}{k} e^{-\lambda} \frac{\lambda^{k-1}}{(k-1)!}=\frac{1}{\lambda}e^{-\lambda}\sum_{k=n}^\infty \frac{\lambda^k}{k!}=\frac{1}{\lambda}\Pr(X\ge n) = \frac{1}{\lambda}(1-F_\lambda(n-1)).$$

A well-known relationship between the Poisson distribution and the Gamma distribution equates this to

$$\frac{1}{\lambda}(1-F_\lambda(n-1)) = \frac{1}{\lambda}\Gamma(\lambda;x)$$

where

$$\Gamma(\lambda;x) = \frac{1}{\Gamma(x)}\int_0^\lambda t^{x-1} e^{-t}\,\mathrm{d}t$$

is the Gamma distribution of parameter $x$. Being proportional to a $\chi^2$ probability, which is a basic statistical computation, it can be obtained with just about any statistical software, as illustrated in R here, using its pgamma function.

Figure

library(data.table)
library(ggplot2)
lambda <- 10 # The Poisson parameter
x <- 1:30
X <- data.table(n=rep(x, 3), lambda=rep(c(5,10,20), each=length(x)))
#
# Here is where the chances are calculated.
#
X[, probability := pgamma(lambda, n)/lambda]
#
# Plot them.
#
ggplot(X, aes(n, probability)) + 
  geom_point(aes(color=factor(lambda)), size=2, alpha=0.8) + 
  guides(color=guide_legend(title=expression(lambda), title.vjust=0)) + 
  theme(legend.title=element_text(size=24)) + 
  ggtitle("(Unconditional) Chance of Being n in Line")
| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

This is not a full answer, but may help you get there.

Say $N$ is the total number of people invited to the party, and $n$ is your position in the arrival sequence. Then from your setup we have that $N-1$ is Poisson distributed with mean 10. So you can answer your questions in two steps: First, you can compute the answers conditional on knowing $N$. Then, you must compute the final answers by incorporating the distribution of $N$.

Your post addresses only the first part. You are correct that $\Pr[n|N]=\frac{1}{N}$, and $\langle n|N\rangle=\frac{N+1}{2}$. To finish, you now need to incorporate the distribution of $N$.

(You also need to account for some unit offsets, i.e. it is $n-1$ people who arrive before you, and it is $N-1$ which is Poisson distributed).

Hope this helps!

| cite | improve this answer | |
$\endgroup$
1
$\begingroup$

Here's my attempt. Let's assume that the number of invitees (excluding you) to the party, $N$, is Poisson distributed with parameter $\lambda$:

$$N\sim \text{POI}(\lambda)$$

Let's further assume that all those invited actually attend the party. Moreover, let the arrival time of you and all other party attendees be uniformly distributed:

$$T_{i}\sim U(0,1)$$

where $i=1,2,\ldots,(N+1)$. Given that all the arrival times are independent and identically distributed, each attendee must equally share the probability of being the $i$th to arrive. Therefore, the probability of being the $i$th attendee, given $N$, is:

$$\text{Pr}(X=i\,|\,N=n)=\frac{1}{n+1}$$

where $i=1,2,\ldots,(n+1)$. Now, this is the conditional distribution. From here we can calculate the joint distribution:

$$\begin{align} \text{Pr}(X=i,\,N=n)&=\text{Pr}(X=i\,|\,N=n)\cdot\text{Pr}(N=n)\notag\\ &=\bigg(\frac{1}{1+n}\bigg)\bigg(\frac{\lambda^{n}e^{-\lambda}}{n!}\bigg) \end{align}$$

To arrive at the marginal distribution for $X$ we need to sum across all values for $N$:

$$\begin{align} \text{Pr}(X=i)&=\sum_{n=i}^{\infty}\text{Pr}(X=i,\,\,N=n)\notag\\ &=\sum_{n=i}^{\infty}\bigg(\frac{1}{1+n}\bigg)\bigg(\frac{\lambda^{n}e^{-\lambda}}{n!}\bigg) \end{align}$$

Note that the lower bound of the summation is that way because in order for you to have an $i$th placing, $n$ has to be larger than or equal to $i$. This is the answer to your second question. Finally, we can calculate the expected value of your arrival rank relative to the other attendees:

$$\begin{align} E[X]&=\sum_{i=0}^{\infty}\sum_{n=i}^{\infty}\text{Pr}(X=i,\,\,N=n)\cdot i\notag\\ &=\sum_{i=0}^{\infty}\sum_{n=i}^{\infty}\bigg(\frac{1}{1+n}\bigg)\bigg(\frac{\lambda^{n}e^{-\lambda}}{n!}\bigg)\cdot i \end{align}$$

Now the above expression may not seem very tractable. But due to the independent and identical distribution of the arrival times we can state the expected number of arrivals after you is the same as the expected number of arrivals before you. Therefore, by symmetry, the expected value of your rank relative to the other attendees can be reasoned as follows:

  • If $\lambda=0$, then you would expect on average to be the first attendee i.e. $E[X]=1$.
  • If $\lambda=1$, then you would expect on average be the first attendee half the time and the second attendee the other half i.e. $E[X]=1.5$.
  • If $\lambda=2$, then you would expect on average be the first attendee a third of the time and the second attendee a third of the time and the third attendee a third of the time i.e. $E[X]=2$.

And so on...Thus you arrive at:

$$\begin{align} E[X]&=\frac{\lambda}{2}+1 \end{align}$$

Interestingly, you verify this expression by evaluating the previously derived expression:

$$\begin{align} E[X]&=\sum_{i=0}^{\infty}\sum_{n=i}^{\infty}\bigg(\frac{1}{1+n}\bigg)\bigg(\frac{\lambda^{n}e^{-\lambda}}{n!}\bigg)\cdot i\\ &=\frac{1}{\lambda}\sum_{i=0}^{\infty}\sum_{n=i}^{\infty}\bigg(\frac{\lambda^{n+1}e^{-\lambda}}{(n+1)!}\bigg)\cdot i\\ &=\frac{1}{\lambda}\sum_{n=0}^{\infty}\sum_{i=0}^{n}\bigg(\frac{\lambda^{n+1}e^{-\lambda}}{(n+1)!}\bigg)\cdot i\\ &=\frac{1}{\lambda}\sum_{n=0}^{\infty}\frac{n(n+1)}{2}\bigg(\frac{\lambda^{n+1}e^{-\lambda}}{(n+1)!}\bigg)\\ &=\frac{1}{\lambda}\sum_{n=0}^{\infty}\frac{n^{2}+n}{2}\bigg(\frac{\lambda^{n+1}e^{-\lambda}}{(n+1)!}\bigg) \end{align}$$

Now, we use a change of variables:

$$M=N+1$$

and

$$m=n+1$$

Leading to:

$$\begin{align} E[X]&=\frac{1}{\lambda}\sum_{m=1}^{\infty}\frac{(m-1)^{2}+(m-1)}{2}\bigg(\frac{\lambda^{m}e^{-\lambda}}{m!}\bigg)\\ &=\frac{1}{2\lambda}\sum_{m=1}^{\infty}\big(m^2-m\big)\bigg(\frac{\lambda^{m}e^{-\lambda}}{m!}\bigg)\\ &=\frac{1}{2\lambda}\Big(E[M^2]-E[M]\Big)\\ &=\frac{1}{2\lambda}\Big(\text{Var}(M)+E[M]^{2}-E[M]\Big)\\ &=\frac{1}{2\lambda}\big(\lambda^{2}+2\lambda\big)\\ &=\frac{\lambda}{2}+1 \end{align}$$

Note, the answer to your first question regarding the expected number of people who arrive before you is simply:

$$E[X]-1=\frac{\lambda}{2}$$

Therefore with $\lambda=10$, you expect

$$\frac{\lambda}{2}=5$$

people to arrive before you. Furthermore, the probability of being the $i$th person to arrive can be shown graphically as (shown below for various $\lambda$): Pr(X=i) for various lambdas

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ The probability and its expectation in fact are very tractable. A bit more analysis can lead to a much simpler solution. $\endgroup$ – whuber Jun 20 '17 at 14:28
  • $\begingroup$ @whuber I said that the expectation may not seem very tractable. I go on to show that it is tractable. I don't see what's wrong with my solution provided. $\endgroup$ – Ed P Jun 20 '17 at 23:05
  • $\begingroup$ I can confirm your solution is correct, +1. The point behind my comment was that it took so much mathematical manipulation for your post to arrive at this solution that (a) it obscures the basic simplicity of the situation and (b) thereby becomes more difficult to verify. $\endgroup$ – whuber Jun 23 '17 at 19:13
  • $\begingroup$ @whuber I can see your point. I suppose I just wanted to show how to get from $\text{Pr}(X=i)$ to $E[X]$ mathematically. $\endgroup$ – Ed P Jun 24 '17 at 5:26
  • 1
    $\begingroup$ There's a nice theorem in that regard for variables supported on the natural numbers $0,1,2,\ldots$: $$E(X)=\sum_{i=0}^\infty \Pr(X\ge i).$$It can be proven using summation by parts. $\endgroup$ – whuber Jun 24 '17 at 10:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.