Why Conditional Branches Matter
Many chance processes unfold in stages. A package may be delivered on time or late, and its chance of arriving undamaged may differ between those cases. A student may pass or fail one assessment before taking another, with the next result depending on the first. To simulate the final outcome, it is not enough to assign one probability to every stage: the probability used at a later stage must match the earlier outcomes that have occurred.
A tree of outcomes makes this structure visible. Each branch represents a possible outcome at one stage. At the next stage, the tree branches again, using probabilities conditional on the path so far. One complete route from the start to an endpoint is a path. A final event can consist of one path or a collection of paths.
The model must specify the probability of every possible outcome at every relevant branch. Probabilities leaving the same branch must sum to 1. The branches also need to describe all possible outcomes of the process, so every simulated trial can be assigned a complete path and classified for the final event.
How to Simulate a Conditional Tree
Suppose a stage has two outcomes, with one occurring with probability \(q\). A software-generated random number \(U\), equally likely to fall anywhere from 0 up to but not including 1, can select that outcome if \(U<q\); otherwise the other outcome occurs. For more than two outcomes, divide the interval from 0 to 1 into sections whose lengths equal the outcome probabilities. At a later stage, use the probabilities for the branch already reached.
A new random number is generated for each stage, and new random inputs are generated for each simulated trial. This is a way to generate outcomes from the stated model; it does not mean the real stages are independent. Dependence in the modeled process is represented by using different conditional probabilities on different branches.
State what process a single simulated run represents, when it begins, and how many stages it includes.
At each stage, record the possible outcomes and their probabilities conditional on the path so far.
Use random input to choose the first outcome, then use the conditional branch matching that outcome at the next stage. Continue until the trial reaches an endpoint.
Check whether the complete path meets the event definition, and record success or non-success for that trial.
For \(n\) simulated trials, estimate the event probability by the number of trials meeting the event divided by \(n\).
The estimate is a Monte Carlo proportion. It describes the fraction of simulated trials meeting the event, not a guarantee about what will happen in a future real process. More trials generally reduce simulation noise, but the model itself must also be appropriate.
Why Path Probabilities Multiply
A tree can also help explain the probability associated with a complete path. Suppose a path first reaches outcome \(A\), then outcome \(B\) conditional on \(A\). By the definition of conditional probability, when \(P(A)>0\),
For a longer path, apply this same relationship at each stage. The probability of the path is the first-branch probability multiplied by each later probability conditional on the outcomes already reached. If an event consists of several distinct terminal paths, its probability is the sum of their path probabilities: the paths cannot occur together in one trial.
Worked Examples
Worked Example: Simulating Whether a Shipment Arrives Undamaged
Hypothetical model. A shipment arrives on time with probability 0.80 and late with probability 0.20. Conditional on arriving on time, it is undamaged with probability 0.95. Conditional on arriving late, it is undamaged with probability 0.80. Estimate the probability that a shipment arrives undamaged using 10 simulated trials.
Model and assumptions. Each trial represents one shipment. The model assumes the stated probabilities apply to each shipment being simulated and that the branch probabilities cover all outcomes. For simulation, use a new random number at each stage. At the first stage, \(U_1<0.80\) means on time; otherwise, late. At the second stage, use \(U_2<0.95\) for undamaged if the shipment was on time, but \(U_2<0.80\) if it was late.
The following hypothetical random inputs give 10 simulated trials. The second random input is interpreted using the conditional threshold for that row.
| Trial | \(U_1\) | \(U_2\) | First-stage outcome | Undamaged? |
|---|---|---|---|---|
| 1 | 0.14 | 0.03 | On time | Yes |
| 2 | 0.68 | 0.77 | On time | Yes |
| 3 | 0.91 | 0.62 | Late | Yes |
| 4 | 0.33 | 0.98 | On time | No |
| 5 | 0.84 | 0.85 | Late | No |
| 6 | 0.07 | 0.54 | On time | Yes |
| 7 | 0.52 | 0.20 | On time | Yes |
| 8 | 0.96 | 0.11 | Late | Yes |
| 9 | 0.73 | 0.94 | On time | Yes |
| 10 | 0.89 | 0.79 | Late | Yes |
For example, trial 5 has \(U_1=0.84\), so the shipment is late. The applicable undamaged threshold is then 0.80, and \(U_2=0.85\) does not meet it. Trial 10 is also late, but \(U_2=0.79<0.80\), so it is classified as undamaged. In total, 8 of the 10 trials meet the event.
The simulation estimate is 0.800. The model probability can also be calculated from the two terminal paths that end in an undamaged shipment:
The estimate from only 10 trials is not expected to equal 0.92 exactly. This particular simulated proportion is lower; a larger run would usually give a more stable estimate, although any finite run can differ from the model probability.
Worked Example: A Three-Stage Inspection Process
Hypothetical model. A product is made from material rated good or weak. The material is good with probability 0.80 and weak with probability 0.20. A calibration passes with probability 0.90 given good material and 0.50 given weak material. A final inspection passes with probabilities 0.98, 0.70, 0.80, and 0.30 for, respectively: good material and calibration pass; good material and calibration fail; weak material and calibration pass; weak material and calibration fail. Estimate the chance of passing final inspection with 8 simulated trials.
Model and assumptions. The tree has three stages: material rating, calibration, and final inspection. The probabilities at each stage are conditional on the full relevant path. They specify an outcome for each branch, and the complementary outcomes have probabilities that complete each branch to 1. To simulate, use a fresh random number at each stage, applying the final-inspection threshold that matches both earlier outcomes.
| Trial | Material input | Calibration input | Final input | Path and final result |
|---|---|---|---|---|
| 1 | 0.24 | 0.32 | 0.50 | Good, pass, pass |
| 2 | 0.61 | 0.94 | 0.85 | Good, fail, fail |
| 3 | 0.88 | 0.41 | 0.67 | Weak, pass, pass |
| 4 | 0.79 | 0.86 | 0.72 | Good, pass, pass |
| 5 | 0.16 | 0.91 | 0.66 | Good, fail, pass |
| 6 | 0.93 | 0.72 | 0.20 | Weak, fail, pass |
| 7 | 0.48 | 0.11 | 0.99 | Good, pass, fail |
| 8 | 0.85 | 0.73 | 0.15 | Weak, fail, pass |
For trial 6, the first input selects weak material because \(0.93\geq0.80\). The calibration input \(0.72\) selects fail because the pass probability on the weak-material branch is 0.50. The final threshold is therefore 0.30, the probability of final pass given weak material and calibration fail; \(0.20<0.30\), so the product passes final inspection. Six of the eight trials pass, giving
For comparison, the model probability is the sum of the four paths that pass final inspection:
The 8-trial estimate, 0.750, is below the model probability, 0.8716. That difference is possible in a short run: the simulation follows the model, but it does not force the observed fraction to equal the model probability.
Worked Example: Estimating the Chance of at Least Two Passes
Hypothetical model. A learner takes three practice assessments. The first is passed with probability 0.70. The second is passed with probability 0.85 given a first-assessment pass, and 0.45 given a first-assessment failure. For the third assessment, the pass probability depends on the number passed in the first two: 0.90 if both were passed, 0.60 if exactly one was passed, and 0.20 if neither was passed. Estimate the probability of passing at least two of the three using 8 simulated trials.
Model and assumptions. Each trial represents one learner following this specified process. Use a new random number for each assessment, and choose the third-stage pass threshold using the first two results. The event is “at least two passes in three assessments,” so a simulated trial is counted when its full path contains two or three passes.
| Trial | First input | Second input | Third input | Passes | At least two? |
|---|---|---|---|---|---|
| 1 | 0.12 | 0.40 | 0.71 | 3 | Yes |
| 2 | 0.66 | 0.91 | 0.35 | 2 | Yes |
| 3 | 0.82 | 0.22 | 0.19 | 2 | Yes |
| 4 | 0.45 | 0.93 | 0.82 | 1 | No |
| 5 | 0.05 | 0.12 | 0.08 | 3 | Yes |
| 6 | 0.95 | 0.32 | 0.47 | 2 | Yes |
| 7 | 0.71 | 0.77 | 0.10 | 1 | No |
| 8 | 0.25 | 0.88 | 0.56 | 2 | Yes |
For trial 8, the first assessment is passed because \(0.25<0.70\). The second is failed because \(0.88\geq0.85\). Since exactly one of the first two assessments was passed, the third-stage threshold is 0.60; \(0.56<0.60\), so the third is passed. Six trials meet the event, so the simulation estimate is
The tree also permits an exact check. Passing both first assessments already meets the event, regardless of the third result. Otherwise, the event occurs when the first two results are pass then fail and the third is passed, or fail then pass and the third is passed. Thus
The simulation estimate of 0.750 is close to the model probability of 0.739 in this short run, but that closeness is not guaranteed. The conditional branches are essential: for example, the second-assessment probability is not the same after a first-stage pass as after a first-stage failure.
Common Mistakes and Practical Checks
- Using one probability at every branch. The mistaken reasoning is that a later stage has one fixed success probability, regardless of the path. The correction is to use the probability conditional on the outcomes already observed. In the shipment example, the undamaged threshold was 0.95 after an on-time arrival but 0.80 after a late arrival.
- Multiplying marginal probabilities as if stages were independent. This can give the wrong path probability when later outcomes depend on earlier ones. Use the branch probabilities written in the tree and multiply the conditional probabilities along the path.
- Reusing the same random input without a reason. This may impose extra dependence between simulated stages that is not part of the model. Generate fresh random inputs for each stage, then let the conditional threshold represent the intended dependence.
- Counting an incomplete path. Decide the event from the complete sequence of outcomes, not just from the first stage. Write down which terminal paths belong to the event before summarizing the simulation.
- Calling a short-run proportion the model probability. The simulated proportion is an estimate and may differ noticeably when the run is small. Report the number of qualifying trials and the total number of trials alongside the estimate.
A conditional tree is useful whenever later chances change with earlier outcomes. It gives a clear record of what the model assumes, directs each simulated stage to the correct probability, and makes it possible to audit how the final event was counted. A carefully implemented simulation cannot correct missing or unsuitable branch probabilities, so those assumptions should be stated before interpreting the estimate.
Check Your Understanding
Use a tree or a short simulation plan to answer these questions.
- In a two-stage process, why might the probability of success at stage 2 need to differ between the branches created at stage 1?
- A first outcome has probability 0.40. Conditional on that outcome, a second outcome has probability 0.70. What is the probability of that two-outcome path?
- For a simulation with 200 trials, 86 paths meet the final-event definition. What is the Monte Carlo estimate of the event probability?
- Why does using fresh random inputs at each stage not require the real stages to be independent?
- A final event can happen through three distinct terminal paths. How would you find its model probability from the tree?