research30 min studyLesson 987 in Engineering

Simulation calibration and external validity

Separate implementation verification, fitting parameters, held-out validation, and transfer beyond a simulator’s tested application domain.

On this page

What you’ll understand

  • Distinguish a correctly implemented model from an adequate representation of a target system.
  • Keep calibration data separate from evidence used to assess predictions.
  • State acceptable error and application domains before interpreting validation.

A simulator can execute its equations perfectly and still answer the wrong systems question. A fitted model can also reproduce every calibration point while missing a queueing transition or topology bottleneck outside them. Verification asks whether the implementation matches the intended model; validation asks whether the model is adequate for a specified use. Neither a clean test suite nor a visually plausible animation provides general external validity.

Define the model’s intended decision and verify its implementation

Write the modeled entities, state transitions, scheduling assumptions, random inputs, and omitted mechanisms. Specify the outputs needed for a decision and acceptable error at relevant operating points. A model adequate for ranking two policies at low load may be inadequate for predicting their extreme tail latency near overload. Validate the intended use rather than the abstract label of simulator. Preserving means while removing burst correlations can change the output that matters, even when every input field has a plausible range.

Implementation verification uses invariants, hand-computable cases, conservation checks, independent implementations, and boundary tests. Check event ordering, time units, random-stream ownership, and numerical tolerances. A deterministic regression fixture can establish that a change preserved a known computation, but it does not establish that the computation represents a real system. Document the conceptual model separately from the executable so a discrepancy can be assigned to assumptions, implementation, or data. Keep stochastic replication uncertainty distinct from systematic disagreement with a physical target.

θ^=arg min⁡θ∑i∈Dcalwi[y^(xi;θ)−yi]2\hat\theta=\operatorname*{arg\,min}_{\theta}\sum_{i\in\mathcal D_{\rm cal}}w_i\left[\hat y(x_i;\theta)-y_i\right]^2
This illustrative weighted least-squares calibration fits θ only on calibration data. For millisecond outputs and dimensionless weights, the objective has units ms². A small fitting objective is not evidence of accuracy on unused conditions or of an identified physical mechanism.↔ Scroll wide equations horizontally.

Calibrate without consuming the validation evidence

Use calibration data to estimate parameters and choose model structure under a documented procedure. Reserve independent conditions, traces, or time periods for validation that are not repeatedly used for tuning. If validation failures trigger another model revision, those failures have become development information; obtain new confirmation evidence where feasible. State how much data informed every choice. A holdout split helps expose overfitting but cannot make an unrepresentative collection suddenly match the intended operating population.

Compare predicted and observed outputs with a tolerance chosen for the intended decision. Relative error can be interpretable for positive times, while absolute error or another scale is needed near zero. Include uncertainty in both simulation and real-system measurements rather than treating noisy observations as exact truth. Test several conditions that exercise expected mechanisms, especially changes in scale or contention. Agreement at one machine size does not validate a simulator’s network contention model on a larger topology.

erel(x)=∣y^(x)−y(x)∣∣y(x)∣,erel(x)≤δ,y(x)≠0e_{\rm rel}(x)=\frac{|\hat y(x)-y(x)|}{|y(x)|},\qquad e_{\rm rel}(x)\le\delta,\quad y(x)\ne0
Relative error and δ are dimensionless. This is a declared pointwise tolerance check for nonzero reference outputs, not a confidence interval, universal accuracy guarantee, or automatic approval for other decision outputs.↔ Scroll wide equations horizontally.

State transfer limits and investigate structured residuals

Plot residuals against load, size, topology, and other modeled variables. A systematic trend can reveal an omitted mechanism even when the average error is small. Use sensitivity analysis to see whether uncertain inputs can reverse a policy ranking. Distinguish interpolation inside a tested region from extrapolation into new hardware or demand regimes. External validation by another group or on another platform adds evidence, but transfer still depends on what changed and whether relevant mechanisms remain represented. Report failures as boundaries of the model’s usable domain.

The function instrument illustrates a known model’s extrapolation without pretending to validate a real simulator. Reset, set both a=0.5 and x=1, predict y=0.5, then Play or Step. Separately Reset, set both a=0.5 and x=2, predict y=2, then Play or Step. The linear rule y=0.5x matches the first observation but predicts one at the second. The fixed quadratic instrument refutes that linear extension within its own noiseless domain; it supplies no physical-system data, fitted simulator, or statistical validation certificate.

A perfect fit can fail a new operating condition

Calibrate a toy time model T(n)=a+bn using exact measurements T(8)=6 ms and T(16)=10 ms. At an unused condition n=32, the measured reference time is 24 ms. A prespecified relative-error tolerance is 10%. Treat these values as exact for the arithmetic.

  1. The fitted slope is b=(10−6)/(16−8)=0.5 ms per unit of n, and a=6−0.5×8=2 ms. Both calibration points are matched exactly.

  2. The prediction at n=32 is 2+0.5×32=18 ms. It misses the held-out reference by |18−24|=6 ms despite zero error at the fitting points.

  3. The relative error is 6/24=0.25, or 25%, above the declared 10% tolerance. Reject adequacy for this tested condition and investigate the residual rather than claiming that calibration validated the larger scale.

The result

Fitting, implementation correctness, and domain-specific predictive adequacy are separate evidentiary tasks.

Explore the model

Interactive lab

Interactive lab · function

Test an extension where a competing model differs

Reset, set both a=0.5 and x=1, predict y=0.5, then Play or Step. Separately Reset, set both a=0.5 and x=2, predict y=2, then Play or Step. The fixed quadratic differs from the linear extrapolation y=0.5x at the second point; it is not physical-system validation.

Test an extension where a competing model differsThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forCalibration agreement does not establish predictive adequacy outside the fitting evidence.

Check your understanding

What does a perfect fit to calibration points establish about a simulator?

Try it yourself

Using T(n)=2+0.5n ms, predict n=24. The held-out reference is 16 ms and the tolerance remains 10%. Compute relative error and decide this pointwise check.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Subtract the prediction from the reference, then divide the absolute difference by the reference value.

Compare with the solution

The prediction is 14 ms and the absolute difference is 2 ms. Relative error is 2/16=12.5%, above 10%, so this point fails the declared tolerance. The arithmetic does not reveal the missing mechanism or quantify reference-measurement uncertainty.

Take it with you

  • Verify the program against the conceptual model and validate the model for its intended use.
  • Reserve prediction checks from calibration and report which evidence informed choices.
  • A tested accuracy domain does not automatically transfer to new loads or platforms.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.