# What distribution is the most appropriate?

I am given the following problem:

A student S wants to take the tram to go home after his lectures are over. The tram line he’s used to take leaves every 7.5 minutes on average at the university. Unfortunately, student S cannot remember the departure times. Thus, he always arrives randomly at the tram station every single weekday.

I am then asked the question which distribution is the most appropriate one to model the daily waiting times of the student.

The random variable $$X$$ reflects the daily waiting time. I thought about an uniform distribution with $$a=0$$ and $$b=7.5$$ since the student arrives randomly at the tram station and thus has equal probability for every waiting time between $$0$$ and $$7.5$$.

So far so good. What is confusing me though is the fact that the arrival of the tram is again a random variable (the tram only arrives every 7.5 min on average). So I am not exactly sure how to model this as the upper bound $$b$$ of the uniform distribution would not always be exactly $$7.5$$ but rather a realisation of the underlying distribution.

I hope someone can explain how I can model this accurately.

• He won’t ever wait ten minutes?
– Dave
Nov 27, 2021 at 15:25
• As stated, the arrival time is random, but the tram arrives at exactly 7.5 min. intervals. If that is what you intended, then waiting time is uniform as you say, which mead wait 3.75 min. With such frequent, reliable service, it doesn't seem important for S to try memory-improvement exercises. Nov 27, 2021 at 15:52
• Would this perhaps be a multiple choice question with "it's impossible to determine an answer from the information given" as an option?
– whuber
Nov 27, 2021 at 19:57

It's perhaps a little more complex than it appears, requiring multiple steps.

First, let's define the train interarrival time ($$x$$) cumulative distribution function as $$F(x)$$, where $$\int xf(x)dx = 7.5$$. Now, it should be intuitively clear that given, say, two interarrival times $$x_1$$ and $$x_2$$, the probability that our hapless student arrives during interval $$x_1$$ is proportional to the length of $$x_1$$, and similarly for $$x_2$$. Since the probability of an interval being of length $$x_1$$ in the first place $$= f(x_1)$$, we can see that:

$$p(\text{Observed interarrival time} = x) \propto xf(x)$$

Integrating $$xf(x)$$ to find the constant of proportionality (well, the part not already hidden in $$f(x)$$) gives us $$7.5$$, the mean interarrival time. So we have:

$$p(x) = {xf(x) \over 7.5}$$

(We will use that $$7.5$$ later on.) Now, if the student arrives randomly during an interval of length $$x$$, the arrival time is uniformly distributed over $$(0,x)$$, which of course implies the remaining time $$t$$ in the interval - i.e., the time until the next train arrives - is also distributed uniformly over $$(0,x)$$. Therefore, $$p(t|x) = (1/x)\, 1(t, where $$1(a)$$ is the indicator function taking on the value $$1$$ if the condition $$a$$ is true, $$0$$ otherwise.

Combining the two expressions gives us:

$$p(t, x) = p(t|x)p(x) = {1 \over x}{xf(x) \over 7.5}1(t

Now we want to integrate out $$x$$ so we can get the marginal distribution of $$t$$. The indicator function makes it clear that the appropriate range of integration of $$x$$ for any given $$t$$ is from $$t$$ to $$\infty$$, as for $$x < t$$ the function being integrated will equal $$0$$.

$$p(t) = {1 \over 7.5}\int_t^{\infty}f(x)dx = {1 \over 7.5}(1-F(t))$$

A quick check: $$\int_0^{\infty}(1-F(t))dt = \mathbb{E}[t] = 7.5$$ (this is a moderately well-known relationship), so we have $${1 \over 7.5}\int_0^{\infty}(1-F(t))dt = 1$$ and we have derived a proper probability distribution. (Of course, the more general solution is $$p(t) = (1-F(t))/\mathbb{E}[t]$$.)

I have ignored the issue of what happens if the student arrives exactly when the train leaves - does he get on the train, in which case the uniform distribution of the waiting time conditional on $$x$$ is over $$[0, x)$$, or does she have to wait for the next one, in which case it's $$(0,x]$$, with appropriate changes to the indicator function etc. Fortunately the difference amounts to a set of measure zero, i.e., the probability of that occurring equals zero, so our final result holds either way.

• Thank you very much for your detailed answer! I have two follow up questions: First, if I understood it correctly the $F(t)$ in the solution is basically the train interarrival time distribution with values $t$ instead of $x$, correct? And second, what distribution is most appropriate for the interarrival times of the train? Exponential maybe?
– coar
Nov 28, 2021 at 11:11
• $F$ is the cumulative distribution function of the interarrival times with values $t$ instead of $x$. I don't believe your second question was the point of the question you were asked, actually. If we want to read "most appropriate" as "most appropriate in the real world", then it's going to be a custom discrete distribution, e.g., the train schedule has the train arrive at 12 midnight, 6AM, 7, 8, 9, 10, 12, 2, 4, 5, 6, 7, 8, 10 and midnight again, so the interarrival times are 6 hours with probability 1/14, 2 hours with probability 5/14, and 1 hour with probability 8/14.... Nov 28, 2021 at 15:38
• The fact that the train has "departure times" in advance (otherwise they wouldn't be available for the student to forget) means the interarrival times have to be generated by a process like that one, not by an exponential distribution or any such. Did the question phrasing actually use "most appropriate"? Nov 28, 2021 at 15:40
• yes, the question phrasing actually uses "most appropriate". Isn't $F(x)$ even in the real world a continous distribution? Even if there is a schedule, the train won't leave at exactly the times given in the schedule (there could be a delay of half a minute or the train leaves 10 seconds early, etc..). I am sorry if this is a stupid question but I am not an expert and relatively new to the subject.
– coar
Nov 28, 2021 at 17:01
• It is not a stupid question at all; thinking like that is essential if you are going to be a good applied statistician some day! You are correct... however, it is hard to guess at what the questioner thinks of as "appropriate". It may be that @BruceET 's comment in response to your question contains the real answer, and what I have provided is overkill! Nov 28, 2021 at 18:13

Assuming that the trams are independent on each other and runs the same way 24/7, their arrivals can be modeled as Poisson process, whose inter-arrival time follows exponential distribution with mean = 7.5 minutes.

Student S entering the queue every day can be considered as a resampling of the process with a random shift t, which does not impact the underlying inter-arrival distribution.

• An exponential interarrival time does not match with the idea that there is a schedule that the student has forgotten. Nov 28, 2021 at 15:54
• @jbowman I think if Poisson process is the right model for the tram arrival, then based on the memoryless property of Poisson process, when Student S arrives at the stop shouldn't impact the wait time. So perhaps Poisson is not a good model for the tram arrival in the question. I will let the op decide. Nov 28, 2021 at 18:21

This sounds like a queueing process. You could model two separate processes $$-$$ the arrival time of the student and the departure time of the tram $$-$$ and use these to construct a model for wait times (the difference between departure and arrival times). Alternatively, you could model the wait times directly. Typically processes of this nature are modeled with skewed distributions like exponential or gamma. If you had actual data it would advisable to view a histogram of your data to get a sense of what model would fit best.

• In this textbook problem, there are no data.
– whuber
Nov 27, 2021 at 19:33

I guess the problem assumes that you'll use the exponential distribution for the waiting time, P(next tram time > t) = 1/(average time) * exp(-t / average time). This is equivalent to saying that tram arrival times follow Poisson process. And then use a memory-less quality of the exponential distribution which is P(next tram time T > a + b | T > a) = P(T > b), i.e. if a tram did not arrive by time a, probability to wait for another b minutes is the same as it was at the beginning. In survival processes exponential distribution is used for a constant hazard - the probability of a tram to arrive at each particular time is the same and does not depend on how much time it was from the last one. In your problem terms, if a student comes at a random time, independent from T, the waiting time distribution will be the same as if a person arrived right after the last tram, and expected to wait the full 7.5 minutes.

Intuitively, if the trams come exactly every 7.5mins, a student will on average wait for 7.5/2 minutes, but as they come randomly and there will be times when the waiting time is long, the average waiting time may be quite long - in case of poisson/exponential distribution, the residual waiting time is at par with non-shifted expected time, however Weibull distribution for example will yield different results, you'd need to use jbowman's density approach to find what it is.

Also, check out this post on this problem https://jakevdp.github.io/blog/2018/09/13/waiting-time-paradox/ or this one Please explain the waiting paradox