After seeing this question, I thought I would try to simulate the bus waiting time paradox to help my understanding. However, what I got was the "intuitive" result, rather than that predicted by the theory.

# draw from Poisson distribution and create the cumulative sum for the bus times
buses <- cumsum(rpois(1000,10))
# draw from uniform distribution and sort for the person arrival times
arrivals <- sort(runif(1000)*1000*10)
# find out which bus is the next bus for each arrival
nextbus <- sapply(arrivals, function(x) which((buses-x)>=0)[1])
# calculate waiting times and present summary statistics
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
 0.02765  2.53200  4.94400  5.48200  7.80200 19.96000       11 

As you can see, the mean wait is a little over half of the mean for the Poisson process. What did I do wrong?

  • 1
    $\begingroup$ You want the times the buses arrive to compute waiting time (exponential), not how many there are in a given time (Poisson). $\endgroup$
    – Glen_b
    Commented Nov 5, 2014 at 14:51

1 Answer 1


You should simulate the Poisson process of bus arrival times by a vector of cumulative exponential variates. So buses <- cumsum(rexp(1000, rate=1/10)).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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