Lesson 2
Deterministic and Stochastic Models
Decide whether randomness belongs in the model, and if so, what kind — then report the result as a distribution.
1 Modelling context
Real systems vary. Trains arrive late by different amounts; a clinic sees different numbers of patients each hour; a component fails after a different number of operating hours each time. Some of this variability is genuine — the world itself is not fixed — and some is an artefact of imperfect observation.
A deterministic model assumes that a given set of inputs always produces the same output. It returns a single trajectory, a single number, a single answer. A stochastic model includes randomness explicitly. Its output is a distribution over possible outcomes, not a single value.
Neither is universally better. The choice is determined by whether randomness is structural — a genuine feature of the process that must be modelled to answer the question — or merely nuisance — measurement noise that can be handled at the input stage. Getting this distinction right is what separates a useful stochastic model from an unnecessary one.
The question you are answering
If the decision turns on an average, a deterministic model may suffice. If the decision turns on variability, tails, or the risk of extreme outcomes, a stochastic model is required — and the mean alone will not be enough.
2 Learning objectives
By the end of this lesson you will be able to
- Distinguish deterministic from stochastic models and identify the appropriate choice for a given question.
- Differentiate structural randomness from nuisance randomness.
- Define a random variable and a stochastic process in the modelling context.
- Explain why a stochastic output must be reported as a distribution, with sampling error.
- Distinguish Monte Carlo sampling error from structural model error.
3 Prerequisite review
- Random variable
-
A quantity whose value depends on the outcome of a random
experiment. Denoted by a capital letter, e.g.
X; a particular observed value is written in lowercase, e.g.x. - Expectation
-
E[X]is the long-run average value ofXover infinitely many independent repetitions of the underlying experiment. - Variance
-
Var(X)measures how farXtypically falls fromE[X]. Its square root is the standard deviation. - Independence
- Two random variables are independent when the outcome of one provides no information about the other.
- Discrete vs. continuous
- A discrete random variable takes values from a countable set (counts, states). A continuous random variable takes values in an interval (times, distances, temperatures).
4 Mathematical formulation
Deterministic models
A deterministic dynamical model has the form
x(t + 1) = f(x(t), θ), x(0) = x₀
where x(t) is the state at step t,
θ is a vector of parameters, and f is a
fixed function. Given x₀ and θ, the
entire future trajectory is determined. Re-running the model
produces the same result every time.
Stochastic models
A stochastic model replaces the deterministic update with a transition rule:
X(t + 1) ~ P( · | X(t), θ)
Here X(t) is a random state, and P is a
distribution (the transition kernel) that assigns probabilities to
possible next states. The model defines a
stochastic process: a family of random variables
indexed by time.
A single execution of the model produces a sample path — one possible trajectory. The quantity of interest is usually an average over many paths, estimated by replication:
E[g(X(t))] ≈ (1/N) Σ g(Xᵢ(t)), i = 1 … N
where each Xᵢ(t) is an independent sample path from
the same model with the same parameters.
Structural vs. nuisance randomness
Not all randomness belongs inside the model. Distinguish:
- Structural randomness. The process itself is random — arrivals at a service point, failures of a component, outcomes of a gamble. Modelling it is necessary if the decision depends on variability or tail risk.
- Nuisance randomness. The process is not random but your observation of it is — sensor noise, rounding, missing data. This can often be handled at the input stage by supplying a best-estimate and a sensitivity range, without making the model itself stochastic.
The two are not mutually exclusive. A model may have structural randomness in its dynamics and nuisance randomness in its parameters. Both must be documented, but they are addressed in different ways.
5 Worked example
A service desk: deterministic or stochastic?
A single service desk receives customers. On average, 8 customers arrive per hour. Each customer takes on average 6 minutes to serve. You are asked to decide how many staff are needed so that customers do not wait more than 10 minutes.
Deterministic model.
-
Assume arrivals are perfectly regular: one customer every 7.5
minutes (
60 / 8). - Assume service times are constant at 6 minutes.
- Then no customer ever waits, because the arrival interval exceeds the service time. The model concludes that one staff member is sufficient.
Why this is misleading.
The deterministic calculation uses the means of two random quantities. But the decision depends on the variability of the arrivals and service times. When arrivals cluster and service times are occasionally long, queues form even when average demand is below average capacity.
Stochastic model.
-
Model arrivals as a Poisson process with rate
λ = 8per hour. -
Model service times as exponential with mean
1/μ = 6minutes, soμ = 10per hour. -
The traffic intensity is
ρ = λ / μ = 8 / 10 = 0.8. -
For an M/M/1 queue, the mean time in the system is
W = 1 / (μ − λ) = 1 / (10 − 8) = 0.5hours, i.e. 30 minutes. - The mean waiting time alone already exceeds the 10-minute target. Worse, the distribution is highly skewed: a substantial fraction of customers wait much longer than 30 minutes.
The decision changes.
The deterministic model recommends one staff member. The stochastic model shows that one staff member cannot meet the target, and quantifies how much worse than the mean the worst cases are. This is not a difference in mathematical sophistication — it is a difference in what each model can support.
6 Verification check
Verifying a stochastic model requires more than checking that the code runs. The following checks establish that the implementation represents the intended process.
Checks to perform
-
Analytical comparison where possible. For an
M/M/1 queue with
ρ = 0.8, the simulated mean time in the system should approach 30 minutes as replications increase. - Seed control. Record the random seed. Rerunning with the same seed must reproduce the same output exactly.
- Input distribution check. Histogram the simulated arrival intervals and compare against the theoretical exponential distribution. Verify the mean and variance match the intended parameters.
-
Limiting cases. As
ρ → 0, the mean queue length should approach zero. Asρ → 1, it should grow without bound. Confirm both numerically. -
Replication convergence. Plot the running
mean of the output against the number of replications. It
should stabilise as
Nincreases. A trend that persists indicates insufficient warm-up or autocorrelation.
7 Interpretation
A stochastic model produces a distribution, and the discipline of interpretation consists of reporting that distribution honestly rather than reducing it to a single number. At minimum, report:
- the mean or median of the output;
- a measure of spread, such as the standard deviation or an interquartile range;
- the sampling error of the estimate, reflecting the finite number of replications;
- relevant tail behaviour — the 95th percentile, the probability of exceeding a threshold, or the worst observed outcome;
- the number of replications and the seed used.
Which of these is most important depends on the decision. For a staffing decision, the 90th or 95th percentile of waiting time matters more than the mean, because the harm is concentrated in the tail. For a throughput estimate, the mean may be sufficient.
Reporting template
A clean way to state a stochastic result is: "Under the stated model, the mean outcome is X (95% CI: A–B), with a 95th percentile of Y. Estimates are based on N = 1,000 replications with seed S. The model assumes [list assumptions]." Every element of this sentence is part of the result.
8 Uncertainty and limitations
Stochastic simulation introduces a source of error that deterministic models do not have: sampling error. This is not a defect of the implementation, but it is a limitation of the result, and it must be quantified.
| Source | Cause | Reduced by | Corrected by |
|---|---|---|---|
| Sampling error | Finite number of replications | More replications, variance reduction | — (asymptotically eliminated) |
| Structural error | Wrong model form, wrong mechanism, wrong inputs | — (unaffected by replication count) | Better modelling, better data, validation |
The critical point is that more replications reduce the first but do nothing to the second. A biased model converges confidently to the wrong answer. Reporting a tight confidence interval around a structurally wrong result is worse than reporting a wide interval around a defensible one, because it conveys false confidence.
Precision is not accuracy
A tight confidence interval on a simulation output means only that the simulation has been run enough times to estimate its own behaviour precisely. It says nothing about whether that behaviour matches the real system.
9 Common implementation errors
Watch for these
- Treating one stochastic run as the answer. A single sample path is a sample of one. It does not estimate the mean, and it certainly does not estimate the tail.
- Reporting the mean without spread. For skewed distributions, the mean can be a poor summary. Report quantiles or an interval alongside it.
- Confusing sampling error with model error. Adding replications reduces the first, never the second.
- Forgetting to set or record the seed. Without a recorded seed, the simulation is not reproducible, and reproducibility is a precondition for audit.
- Assuming that deterministic code implies a deterministic model. A simulation may be implemented in deterministic code and still represent a stochastic process, because the pseudorandom stream is deterministic. What matters is what the model represents, not how the code executes.
- Modelling nuisance randomness as structural randomness. This inflates reported uncertainty and can obscure the real drivers of variability.
10 Independent modelling task
Your turn
- Start from a deterministic model you have built or encountered — a simple forecast, a budgeting model, a queueing estimate.
- Identify one parameter that might plausibly be random rather than fixed. State whether you classify the randomness as structural or nuisance, and justify the classification in one sentence.
- Replace the fixed parameter with a random one — choose a distribution and justify it. If you do not know the distribution, choose the simplest reasonable one and state the assumption explicitly.
- Run 100 replications of the modified model. Plot a histogram of the output and report the mean, the standard deviation, and the 95th percentile.
- Compare the deterministic and stochastic results. In one paragraph, describe what the stochastic model reveals that the deterministic one hid.
Keep this comparison. It will inform the parameterization component of Assignment 1.
11 Reflection prompt
Reflect before continuing
In your own experience with forecasts or models, when has a single-number prediction hidden variability that turned out to matter?
Then consider the inverse: when has a model been made stochastic unnecessarily, adding complexity and uncertainty that did not help the decision? Two or three sentences is enough. The point is to sharpen your judgement about when randomness belongs inside the model.
12 Lesson summary
Key takeaways
- Deterministic models return a single value; stochastic models return a distribution.
- Structural randomness belongs in the model. Nuisance randomness belongs in the input assumptions.
- A single sample path is not the answer. Replication is required to estimate the quantities of interest.
- Report the distribution, not just the mean. For skewed outputs, the tail is often what matters.
- Sampling error and structural error are different. Replication reduces the first; only better modelling reduces the second.
Coming next
Lesson 3 assembles the classification decisions of Lessons 1 and 2 into the fourteen-step computational modelling lifecycle that governs the rest of the course.
§ Self-quiz, practice, and homework
Self-quiz
Q1
Which of the following is a structural source of randomness?
Show answer
Genuine variability in patient arrival times. The process itself is random, not merely our observation of it.
Q2
A stochastic model's output should be reported as:
Show answer
A distribution, with sampling error. A single number conceals the variability that the model was built to represent.
Q3
Doubling the number of replications in a simulation:
Show answer
Reduces sampling error. Structural error is unaffected by replication count.
Q4
Which of these is best modelled as a stochastic process?
Show answer
Number of arrivals at a bus stop. The arrival process is genuinely random.
Q5
A tight confidence interval around a simulation output:
Show answer
Means the simulation has been run many times precisely. Precision is not accuracy.
Practice exercises
- For each of the following, state whether the variability is structural or nuisance, and justify briefly: (a) variations in the measured length of a metal bar; (b) variations in the number of emails received per hour; (c) variations in the time taken by a customer to complete a purchase; (d) rounding differences in a currency conversion.
- A deterministic model predicts a train will arrive in 12 minutes. A stochastic model predicts the arrival time follows a normal distribution with mean 12 minutes and standard deviation 3 minutes. Write one sentence each stating what each model supports.
- Explain in two sentences why "adding more replications" cannot fix a model that omits a relevant variable.
- Choose a deterministic relationship you know (e.g. Ohm's law, distance = speed × time). Describe a situation in which the same relationship would become stochastic.
Homework problems
- Deterministic-to-stochastic conversion. Take a small deterministic model you know (e.g. compound interest, a linear forecast, a queueing calculation using means). Identify one parameter that could be random, choose a plausible distribution for it, and justify the choice. Modify the model and run 100 replications (in Excel or by hand if you must). Report the mean, standard deviation, and 95th percentile. Compare against the deterministic version and describe what the stochastic version reveals.
- Sampling vs. structural error. Construct a simple simulation (e.g. estimating π by throwing random points in a square). Run it with 100, 1000, and 10000 replications. Plot the estimate and the 95% confidence interval for each. Then deliberately bias the simulation (e.g. by using a square that is not quite a unit square). Show how the confidence interval converges to the wrong answer. Write 300 words on what this demonstrates.
- Stochastic model design. Choose a service system (a bank, a clinic, a checkout counter). Write a 500-word design for a stochastic model: the entities, the arrival process, the service process, and the quantities of interest. Justify each choice. State the model's claim-support scope.
Mini project
Build a simple stochastic model in a spreadsheet. Suggested subjects: a coin-tossing game with a stopping rule; a gambler's ruin problem; a simplified inventory model with random demand. Run at least 100 replications, record the seed, report the mean, standard deviation, and 95th percentile of the primary output, and compare the distribution against a theoretical benchmark if one exists. Submit the spreadsheet, a one-page technical summary, and a one-paragraph plain-language summary.