Unit 13, lesson 84

A Complete Introduction to Probability Investigation

How to combine parcel categories, Poisson arrivals, exponential waits and a two-state scanner chain into one model, multiply only where independence was assumed, test sensitivity and check one submodel by simulation.

  • Video 84
  • Complete Model Investigations

A parcel hub receives parcels at random times, some parcels are priority and some arrive delayed from upstream, and a scanner at the hub is sometimes out of service. Useful questions about the hub draw on these parts, alone or together, such as the chance of a delay among the next five parcels, the wait until the next arrival and the chance that the scanner works at a later checkpoint. This lesson builds one model from three submodels with stated links between them, computes exact answers, checks one submodel with a recorded simulation and names the questions the model leaves open. Every numerical input is constructed for teaching, so the internal consistency of the model says nothing about how a real hub behaves.

Key terms

Combined probability model

Definition A combined probability model joins several submodels, each describing one part of a system, and states how the submodels relate, for example which of them are independent of each other. It is complete for a question when these statements determine the probability of every event the question involves, including events that involve more than one part.

In plain words Build the model in pieces that each make sense on their own, then say explicitly how the pieces fit together. Without the second step, a question that mixes two pieces usually has no definite answer.

Example The hub model has three submodels.

  • Arrivals form a homogeneous Poisson process with rate λ=4\lambda = 4 per hour. The number N(t)N(t) of arrivals in the first tt hours, and more generally the number in any time interval of length tt hours, has the Pois⁡(4t)\operatorname{Pois}(4t) distribution, and the counts in disjoint intervals are independent.
  • Each parcel is priority, the event HH, with probability 0.250.25. It has an upstream delay, the event DD, with probability P(D∣H)=0.3P(D \mid H) = 0.3 if it is priority and P(D∣Hc)=0.1P(D \mid H^{c}) = 0.1 if not. The delay refers to travel before the hub, not to anything that happens at the hub. The priority and delay marks are independent across parcels and independent of the arrival times.
  • A scanner is observed at hourly checkpoints n=0,1,2,…n = 0, 1, 2, \dots, with checkpoint nn at hour nn on the arrival clock, and is either available, state AA, or unavailable, state UU. Its state XnX_n is a Markov chain that starts at X0=AX_0 = A, and the chain is independent of the arrivals and the parcel marks taken together.

The transition matrix of the scanner chain, with rows and columns in the order AA, UU, is

P=[0.80.20.40.6].P = \begin{bmatrix} 0.8 & 0.2 \\ 0.4 & 0.6 \end{bmatrix}.

Priority and ordinary parcels partition the parcels, and the two routes to a delay contribute 0.25⋅0.3=0.0750.25 \cdot 0.3 = 0.075 and 0.75⋅0.1=0.0750.75 \cdot 0.1 = 0.075. The law of total probability gives P(D)=0.15P(D) = 0.15, and Bayes’ theorem gives

P(H∣D)=0.0750.15=0.5.P(H \mid D) = \frac{0.075}{0.15} = 0.5 .

A parcel is priority with probability 0.250.25, but a delayed parcel is priority with probability 0.50.5.

Independence of submodels

Definition Two submodels are independent when every event determined by one of them is independent of every event determined by the other, so that

P(E∩G)=P(E) P(G)P(E \cap G) = P(E)\,P(G)

for every event EE of the first and every event GG of the second. In a combined model this is an assumption written into the specification. It allows a joint probability across submodels to be computed as a product, and it says nothing about two events inside one submodel, which may be dependent by design.

In plain words Multiply probabilities from different parts only when the model says those parts are independent, and check that the two events really belong to different parts. Priority and delay belong to the same parcel, so an independence assumption between submodels does not cover them.

Example Let WW be the event that at least one parcel arrives between hour 2 and hour 2.25, the quarter hour after checkpoint 2. The arrival count for a quarter hour is Pois⁡(1)\operatorname{Pois}(1), since 4⋅0.25=14 \cdot 0.25 = 1, so P(W)=1−e−1P(W) = 1 - e^{-1}. The card on checkpoint availability finds P(X2=A)=0.72P(X_2 = A) = 0.72. The scanner chain and the arrivals were assumed independent, so

P({X2=A}∩W)=0.72 (1−e−1)≈0.4551.\begin{aligned} &P(\{X_2 = A\} \cap W) \\[0.4em] &\quad = 0.72\,(1 - e^{-1}) \\[0.4em] &\quad \approx 0.4551 . \end{aligned}

This is a statement about availability at one instant and arrivals in a later interval. It does not give the probability that every parcel arriving in that quarter hour is scanned at once, which would need the scanner to be available throughout the interval, something the model does not describe. By contrast, the product P(H) P(D)=0.25⋅0.15=0.0375P(H)\,P(D) = 0.25 \cdot 0.15 = 0.0375 is not P(H∩D)P(H \cap D), which equals 0.0750.075, because priority and delay are dependent within one parcel.

Fixed batch versus fixed time window

Definition A fixed batch is a predetermined number nn of parcels, such as the next five, however long they take to arrive. Because the marks are independent across parcels and independent of the arrival times, the number KK of delayed parcels in the batch satisfies K∼Bin⁡(n,0.15)K \sim \operatorname{Bin}(n, 0.15). A fixed time window is a time interval of predetermined length tt hours. The number of parcels arriving in it has the Pois⁡(4t)\operatorname{Pois}(4t) distribution and is itself random, so the number of delayed parcels in a window depends on the arrival submodel as well as on the marks, while the distribution of KK for a fixed batch comes from the parcel marks alone.

In plain words Name the observation unit before calculating. A batch of five parcels has a fixed size and a random duration, and a one-hour window has a fixed duration and a random number of parcels, even though the hub averages four parcels per hour.

Example For the next five parcels, K∼Bin⁡(5,0.15)K \sim \operatorname{Bin}(5, 0.15), so E[K]=0.75E[K] = 0.75 and

P(K≥1)=1−0.855≈0.5563.\begin{aligned} P(K \ge 1) &= 1 - 0.85^{5} \\[0.4em] &\approx 0.5563 . \end{aligned}

For time, the chance of no arrivals in the first hour is P(N(1)=0)=e−4≈0.0183P(N(1) = 0) = e^{-4} \approx 0.0183. From time 00, the wait TT until the first arrival exceeds tt hours exactly when the first tt hours contain no arrival, so for t≥0t \ge 0

P(T>t)=P(N(t)=0)=e−4t,\begin{aligned} P(T > t) &= P(N(t) = 0) \\[0.4em] &= e^{-4t} , \end{aligned}

and T∼Exp⁡(4)T \sim \operatorname{Exp}(4) with rate 44 per hour. The same argument applied to the window after any fixed starting time gives the same distribution for the wait from that time. Fifteen minutes is 0.250.25 hour, so the next arrival comes within 15 minutes with probability 1−e−1≈0.63211 - e^{-1} \approx 0.6321. The mean wait is 1/41/4 hour, which is 15 minutes, but the median wait is (ln⁡2)/4(\ln 2)/4 hour, about 10.4 minutes, and no single wait is guaranteed to be close to the mean. Delays in a one-hour window are a third question. Their expected number is 4⋅0.15=0.64 \cdot 0.15 = 0.6 by the rule for random sums with independent counts, since the marks are independent of the count, but their distribution is not Bin⁡(4,0.15)\operatorname{Bin}(4, 0.15), because the number of parcels in the hour is random.

Checkpoint availability

Definition For the scanner chain, the checkpoint availability at checkpoint nn is pn=P(Xn=A)p_n = P(X_n = A), the probability that the scanner is available at that instant. Conditioning on the state at checkpoint nn gives the recurrence

pn+1=0.8 pn+0.4 (1−pn)=0.4+0.4 pn.\begin{aligned} p_{n+1} &= 0.8\,p_n + 0.4\,(1 - p_n) \\[0.4em] &= 0.4 + 0.4\,p_n . \end{aligned}

A stationary distribution π=(πA,πU)\pi = (\pi_A, \pi_U) satisfies πP=π\pi P = \pi and πA+πU=1\pi_A + \pi_U = 1. The first coordinate of πP=π\pi P = \pi reads πA=0.8 πA+0.4 πU\pi_A = 0.8\,\pi_A + 0.4\,\pi_U, and with πU=1−πA\pi_U = 1 - \pi_A it becomes πA=0.4+0.4 πA\pi_A = 0.4 + 0.4\,\pi_A. So πA=2/3\pi_A = 2/3, and the only stationary distribution is π=(2/3,1/3)\pi = (2/3, 1/3). Subtracting 2/32/3 from both sides of the recurrence gives

pn−23=0.4n(p0−23),p_n - \frac{2}{3} = 0.4^{n} \left(p_0 - \frac{2}{3}\right),

so pn→2/3p_n \to 2/3 from every starting distribution. This agrees with the general result for an irreducible, aperiodic chain on a finite state space, and here the formula also shows that the gap shrinks by the factor 0.40.4 at each step.

In plain words Checkpoint availability is a probability about the scanner’s state at one checkpoint. It says nothing about whether the scanner stays up between checkpoints, since the model records nothing in between. The stationary value 2/32/3 is the limit of these checkpoint probabilities, not a statement that the scanner works for two thirds of each hour.

Example Starting from X0=AX_0 = A, the first checkpoint has p1=0.8p_1 = 0.8. A scanner available at checkpoint 2 got there either by staying available or by failing and recovering, so

p2=0.8⋅0.8+0.2⋅0.4=0.64+0.08=0.72.\begin{aligned} p_2 &= 0.8 \cdot 0.8 + 0.2 \cdot 0.4 \\[0.4em] &= 0.64 + 0.08 = 0.72 . \end{aligned}

Availability at both checkpoints 1 and 2 is a different event, with probability 0.8⋅0.8=0.640.8 \cdot 0.8 = 0.64, because it excludes the path that fails and recovers. The deviation formula gives p2=2/3+0.16⋅1/3=0.72p_2 = 2/3 + 0.16 \cdot 1/3 = 0.72 again, and the later values p3=0.688p_3 = 0.688 and p4=0.6752p_4 = 0.6752 continue toward 2/32/3.

Sensitivity analysis

Definition A sensitivity analysis changes one input or one assumption of a model, holds the rest of the specification fixed, and recalculates the outputs. In a combined model with independent submodels, a change to the inputs of one submodel can change only the answers that involve that submodel, including joint answers that multiply its probabilities. Answers that involve only the other submodels stay the same, as long as the independence assumptions are kept.

In plain words The structure of the model tells you in advance which answers a change can reach. Whether the independence assumptions themselves still hold after a real change is a separate question about the hub, and the algebra cannot settle it.

Example Raise the arrival rate from 44 to 66 per hour and keep everything else. The chance of no arrivals in an hour falls from e−4≈0.0183e^{-4} \approx 0.0183 to e−6≈0.0025e^{-6} \approx 0.0025, the mean wait falls from 15 to 10 minutes, and the chance of an arrival within 15 minutes rises from about 0.63210.6321 to 1−e−1.5≈0.77691 - e^{-1.5} \approx 0.7769. The joint probability from the card on independence of submodels becomes

0.72 (1−e−1.5)≈0.5593.0.72\,(1 - e^{-1.5}) \approx 0.5593 .

The five-parcel batch probability stays 1−0.855≈0.55631 - 0.85^{5} \approx 0.5563, because a batch is defined by its parcels and not by time, and the scanner values 0.720.72 and 2/32/3 stay as well.

Simulation check of a submodel

Definition A simulation check of a submodel generates outcomes from that submodel with a stated program, generator and seed, records the output, and compares the resulting estimate with the exact prediction using its Monte Carlo standard error. For an event with exact probability pp, estimated by its frequency in mm independent simulated repetitions, the standard error is p(1−p)/m\sqrt{p(1 - p)/m}. Such a check tests whether the program and the calculation agree for that submodel only. It says nothing about submodels that were not simulated, and nothing about whether the model describes a real system.

In plain words Three different things stay separate. The exact prediction is fixed by the model. A simulated output varies from run to run, typically by about one standard error. Whether the model fits real parcels, arrivals and scanners is an empirical question that neither the prediction nor the simulation can answer.

Example One run was recorded with Python 3.12.14 and the generator random.Random(55012). It simulated 10,000 independent five-parcel batches. For each parcel it drew the priority flag first, priority when random() was below 0.250.25, and then the delay flag, delayed when the next draw was below 0.30.3 for a priority parcel or below 0.10.1 otherwise. At least one delay occurred in 5501 batches, an estimate of 0.55010.5501. The exact probability is about 0.55630.5563, and the standard error is

SE⁡=0.5563⋅0.443710000≈0.00497,\begin{aligned} \operatorname{SE} &= \sqrt{\frac{0.5563 \cdot 0.4437}{10000}} \\[0.4em] &\approx 0.00497, \end{aligned}

so the estimate lies about 1.251.25 standard errors below the prediction, a gap of ordinary size for Monte Carlo error. The run also recorded 7443 delayed parcels among 50,000, a fraction of 0.14890.1489 against P(D)=0.15P(D) = 0.15, and 3745 of the delayed parcels were priority, a fraction of about 0.5030.503 against P(H∣D)=0.5P(H \mid D) = 0.5. The run contains no arrival times and no scanner states, so it checks the parcel submodel and nothing else.

Check yourself

  1. Suppose the scanner is unavailable at checkpoint 0. Find its availability at checkpoints 1 and 2, the probability that it is available at both checkpoints 1 and 2, and the limit of pnp_n.
Show the answer

From state UU the scanner recovers with probability 0.40.4, so p1=0.4p_1 = 0.4. The recurrence gives p2=0.4+0.4⋅0.4=0.56p_2 = 0.4 + 0.4 \cdot 0.4 = 0.56, which is the sum over the two paths, 0.4⋅0.8+0.6⋅0.4=0.32+0.240.4 \cdot 0.8 + 0.6 \cdot 0.4 = 0.32 + 0.24. Availability at both checkpoints needs the path that recovers at checkpoint 1 and stays available, with probability 0.4⋅0.8=0.320.4 \cdot 0.8 = 0.32, smaller than p2p_2. With p0=0p_0 = 0 the deviation formula gives

pn=23−23⋅0.4n,p_n = \frac{2}{3} - \frac{2}{3} \cdot 0.4^{n},

so pn→2/3p_n \to 2/3, the same limit as from X0=AX_0 = A.

  1. A colleague multiplies two pairs of probabilities. The first product, 0.72⋅(1−0.855)≈0.40050.72 \cdot (1 - 0.85^{5}) \approx 0.4005, is offered as the probability that the scanner is available at checkpoint 2 and the next five parcels include at least one delay. The second, 0.25⋅0.15=0.03750.25 \cdot 0.15 = 0.0375, is offered as the probability that a parcel is priority and delayed. Which product does the model justify?
Show the answer

The first product is justified. The scanner event belongs to the chain, the batch event is determined by the arrivals and the parcel marks, and the chain was assumed independent of those two taken together, so their joint probability is 0.72⋅0.5563≈0.40050.72 \cdot 0.5563 \approx 0.4005. The second is not. Priority and delay belong to the same parcel and are dependent, since P(D∣H)=0.3P(D \mid H) = 0.3 differs from P(D)=0.15P(D) = 0.15. The correct value is

P(H∩D)=0.25⋅0.3=0.075,\begin{aligned} P(H \cap D) &= 0.25 \cdot 0.3 \\[0.4em] &= 0.075, \end{aligned}

twice the product. Independence between submodels does not justify multiplying the probabilities of two events inside one submodel.

  1. Change the priority probability from 0.250.25 to 0.50.5 and keep both conditional delay probabilities. Find P(D)P(D), P(H∣D)P(H \mid D) and the probability of at least one delay among the next five parcels. Which earlier answers stay the same, and what could make that conclusion fail at a real hub?
Show the answer

The two routes to a delay now contribute 0.5⋅0.3=0.150.5 \cdot 0.3 = 0.15 and 0.5⋅0.1=0.050.5 \cdot 0.1 = 0.05, so P(D)=0.2P(D) = 0.2 and

P(H∣D)=0.150.2=0.75.P(H \mid D) = \frac{0.15}{0.2} = 0.75 .

For five parcels, K∼Bin⁡(5,0.2)K \sim \operatorname{Bin}(5, 0.2), so E[K]=1E[K] = 1 and

P(K≥1)=1−0.85=0.67232.\begin{aligned} P(K \ge 1) &= 1 - 0.8^{5} \\[0.4em] &= 0.67232 . \end{aligned}

The arrival and scanner answers stay the same, including e−4e^{-4}, 1−e−11 - e^{-1}, 0.720.72, 2/32/3 and the joint value 0.45510.4551, because their inputs did not change and the model makes them independent of the parcel marks. The scanner and batch value from question 2 does change, to 0.72⋅0.67232≈0.48410.72 \cdot 0.67232 \approx 0.4841, because it involves the batch. At a real hub, more priority parcels might bring more handling work, more scanner failures or a different arrival pattern. Any such link would change the arrival or scanner submodel or break its independence from the parcel marks, and the remedy would be a new model, not a change of one number.

How this lesson connects