Suppose you have a section of road with two-way traffic, and some basic information about traffic volumes, for example:

Let $l_a$ be the number of light vehicles per hour that travel across this road in one direction, and let $h_a$ be the number of heavy vehicles per hour that travel across the road in the same direction. Similarly, Let $l_b$ and $h_b$ be the number of light and heavy vehicles that travel across the road per hour in the opposite direction. We should assume that these are random - so I suppose, for any given vehicle, the time that they would begin to cross this section of road would have a uniform distribution.

Assume that any vehicle takes $x$ seconds to travel across this section of road.

How could one calculate the probability that a light vehicle will interact with an opposing heavy vehicle on this section of road, say, in any given hour?

I'm not used to this aspect of time in probability calculations, since I've only done second year university statistics. Would we have to discretize the problem somehow?

  • $\begingroup$ Do you know anything about the process of light and heavy vehicles arriving? Simply having number of vehicles in a given time interval isn't enough. $\endgroup$
    – fanvacoolt
    Commented Jul 5, 2018 at 3:01
  • $\begingroup$ @fanvacoolt I may have access to extra data - what in particular are you referring to? $\endgroup$ Commented Jul 5, 2018 at 4:23
  • $\begingroup$ If this is a problem from a text and in the vicinity of where exponential distributions are introduced, my guess is you're intended to use exponential distributions to model the four kinds/directions of traffic. $\endgroup$
    – BruceET
    Commented Jul 5, 2018 at 4:47
  • $\begingroup$ @BruceET this is not from a text, it is just a generic problem $\endgroup$ Commented Jul 5, 2018 at 5:04
  • $\begingroup$ @CoffeeDonut, I think I understood what you meant. Suppose you have time interval $[0, T]$. Numbers $l_a, h_a, l_b, h_b$ are constant, and each of $l_a + h_a + l_b + h_b$ vehicles has uniform distribution of their starting time over interval $[0, T]$, correct? Also, are these numbers big or small, or are you interested in general solution? $\endgroup$
    – fanvacoolt
    Commented Jul 5, 2018 at 16:28

2 Answers 2


Not a complete solution, but you might work on it to improve.

First, it is unclear from your description, so I assumed that numbers $l_a, l_b, h_a, h_b$ are fixed, and every vehicle starting time is uniformly distributed over time interval $[0, T]$. If the numbers are not random, then this method gives you conditional probability.

Second, as I understood, light and heavy vehicles are interacting only when move in opposite directions. In this case you have $X_{AB}$ (number of interaction of light vehicles moving from $A$ to $B$ with heavy vehicles moving from $B$ to $A$) and $X_{BA}$ (vice versa) are independent, so you can calculate two cases separately.

So now we consider the following setup: over time interval $[0, T]$ we have $n_1$ vehicles moving in one direction, each vehicle has starting time $x_1, x_2, \ldots, x_{n_1}$ uniformly distributed over $[0, T]$; and $n_2$ vehicles moving in opposite direction, with starting times $y_1, y_2, \ldots, y_{n_2}$ also uniform in same interval. Each vehicle takes time $\tau$ to cross the road section from one end to another.

Consider vehicle with starting time $x_1$. It will interact with no one, if there is no vehicles moving in opposite direction in time interval $\bigl[x_1 - \tau, x_1 + \tau\bigr]$, or, remembering about border conditions, $\bigl[\max(0, x_1 - \tau), \min(T, x_1 + \tau)\bigr]$. Denote this interval as $T_{x_1}$. We can build do the same for vehicles starting at time $x_2, x_3, \ldots, x_{n_1}$, obtaining intervals $T_{x_2}, T_{x_3}, \ldots, T_{x_{n_1}}$.

Now consider vehicle heading in opposite direction, that starts at time $y_1$. When does it interact with no one? When it is not in $T_{x_1}$, and not in $T_{x_2}$, and so on. In other words, $y_1$ must lie outside of interval $T_1 = T_{x_1}\cup T_{x_2}\cup\ldots\cup T_{x_{n_1}}$, doesn't matter where. Same goes for $y_2, y_3, \ldots, y_{n_2}$. So now we calculate probability of having zero interactions at all, given $T_1$, as

$$ \Biggl(\frac{T - |T_1|}{T}\Biggr)^{n_2} = \Biggl(\frac{T - |T_2|}{T}\Biggr)^{n_1}, \text{and} $$

where $|T_1|$ is length of interval $T_1$. Then total probability of no interactions is

$$ \int_0^T \Biggl(\frac{T - |T_1|}{T}\Biggr)^{n_2}\cdot\mathrm{Pr}(|T_1| = t) = \int_0^T \Biggl(\frac{T - |T_2|}{T}\Biggr)^{n_1}\cdot\mathrm{Pr}(|T_2| = t) $$

Now the real problem lies in calculating distribution of $|T_1|$ for given $n_1$ and $\tau$. As far as I'm aware there is no closed form, only asymptotics. However, it is not too hard to implement a function which unites $n_1$ intervals, given $x_1, \ldots, x_{n_1}$, and returns length on the union $|T_1|$. Then you can integrate it over $n_1$-dimensional cube $[0, T]^{n_1}$, getting

$$ \mathrm{Pr(\text{no interactions})} = \int_0^T\int_0^T\ldots\int_0^T\Biggl(\frac{T - |T_1|(x_1, x_2, \ldots, x_{n_1})}{T}\Biggr)^{n_2})\cdot\frac{dx_1 dx_2\ldots dx_{n_1}}{T^{n_1}} $$

This integral might be evaluated numerically for small $n_1$, or using Monte-Carlo sampling for bigger $n_1$. This is particularly advantageous if one of $n_1, n_2$ is much smaller than the other (say, you have fewer heavy vehicles than light vehicles), as you can swap them.

Below is the graph for probability of no interactions for two different cases of $(n_1, n_2)$ and various $\tau$. On my computer evaluation of the integral takes around $60$ seconds through Monte-Carlo sampling with accuracy $10^{-6}$.

Probability of having 0 interactions

Your particular question was what is a probability of having at least one interaction, which is

$$ 1 - \mathrm{Pr}(X_{AB} = 0)\cdot\mathrm{Pr}(X_{BA} = 0), $$

where for $X_{AB}$ you have $n_1 = l_a$ and $n_2 = h_b$, and for $X_{BA}$ you have $n_1 = l_b$ and $n_2 = h_a$.


Some hints to get you started:

Suppose we are talking about a 10-second period of (interaction) time for a vehicle to pass through the stretch of road we are monitoring. Also suppose the average number of light northbound vehicles there in a particular 10 second period of time is $\lambda = 1$ and the average number of heavy southbound vehicles then and there is $\eta = 0.5.$

Then we want at least one light northbound vehicle (probability 0.6321) and at least one heavy southbound vehicle (probability .0.3935). So, assuming independence, the probability of both is the product 0.2487. (Computations in R statistical software.)

1 - dpois(0, 1)
## 0.6321206
1 - dpois(0, .5)
## 0.3934693
(1 - dpois(0, 1))*(1 - dpois(0, .5))
## 0.2487201

A similar argument gets you the near-simultaneous passage of at least one heavy northbound vehicle and one light southbound vehicle. Combine the results to get the probability of an 'interaction' in a 10-second period. Then think about an hour.

You will have to adjust your hourly means to 10-second means for your initial computations. In each of the original four probabilities, use the formula for the Poisson PDF (or PMF) to get the probability of no vehicle.

Note: This problem could also be worked using CDFs of exponential distributions to give the same answers.

  • 1
    $\begingroup$ Thanks for this, this makes sense to me. Just a clarifying question: Let's say I have a 30 second interaction period, and I have worked out the probability of at least one interaction during this period is $x$. Since 3600/30 = 120, there are 120 'lots' of 30 second intervals in an hour. The probability of at least one interaction in an hour is therefore $1-((1-x)^{120})$, correct? Do I have to worry about 'overlapping' intervals or anything? $\endgroup$ Commented Jul 6, 2018 at 2:58
  • 1
    $\begingroup$ Reasonable to have disjoint, independent intervals as 'interaction periods'. $\endgroup$
    – BruceET
    Commented Jul 6, 2018 at 3:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .