← Deterministic Models

13

Parameter comparisons and sensitivity experiments

A model outcome depends on its parameter values. Parameter comparison shows how selected scenarios differ, while sensitivity analysis measures how strongly an outcome responds to small parameter changes around a stated baseline.

Biological scenario

For an SIR epidemic in a population of 1,000, the baseline parameters are \(\beta=0.30\) and \(\gamma=0.10\) per day.

We want to investigate how transmission and recovery affect the infectious peak and final outbreak size.

Start with an exactly understandable sensitivity

Before using simulation, consider the basic reproduction number for the simple SIR model:

\[\mathcal{R}_0=\frac{\beta}{\gamma}.\]

At \(\beta=0.30\) and \(\gamma=0.10\), we have \(\mathcal{R}_0=3\).

Increase transmission by 1%

If \(\beta\) increases by 1% while \(\gamma\) remains fixed, \(\mathcal{R}_0\) increases by exactly 1%. Its normalized sensitivity to \(\beta\) is +1.

Increase recovery by 1%

If \(\gamma\) increases by 1%, \(\mathcal{R}_0\) decreases by approximately 1% for a small change. Its normalized local sensitivity to \(\gamma\) is −1.

The signs are intuitive: greater transmission increases epidemic potential, while faster recovery decreases it. This simple example gives meaning to a sensitivity coefficient before we calculate one numerically.

Four complementary questions

QUESTION 1Exact formula sensitivity

How does \(\mathcal{R}_0=\beta/\gamma\) respond algebraically?

QUESTION 2One parameter at a time

How do full epidemic curves change across selected \(\beta\) values?

QUESTION 3Two-parameter response

How does peak size vary across combinations of \(\beta\) and \(\gamma\)?

QUESTION 4Intervention timing

How does changing the day of a transmission reduction alter peak and final size?

QUESTION 5Local coefficient

What is the derivative-like response near the baseline?

QUESTION 6Robustness

Does the conclusion change with the perturbation size or parameter range?

Design a fair comparison

Population1,000
Initial state\(S_0=990,I_0=10,R_0=0\)
Time interval0–200 days
Numerical settingssame solver and tolerances
PrincipleReason
State the baseline.A parameter effect is interpreted relative to a reference model.
Change only intended quantities.Otherwise the source of an outcome difference becomes unclear.
Use biologically meaningful ranges.Extreme values may answer an irrelevant question.
Use identical numerical settings.Differences should not arise from inconsistent computation.
Choose outcomes before running.This avoids selecting only results that appear interesting afterwards.

One-at-a-time comparison

Choose several transmission values:

\[\beta\in\{0.20,0.25,0.30,0.35,0.40\},\]

while fixing \(\gamma=0.10\). This isolates the model response to \(\beta\) along that particular line through parameter space.

One-at-a-time comparison is easy to interpret, but it does not reveal interactions that occur when several parameters change together.

Two-parameter experiment

A grid evaluates every selected combination of \(\beta\) and \(\gamma\). Results can be stored in a two-dimensional array:

peak_grid = np.zeros(
    (len(gamma_values), len(beta_values))
)

The row index identifies a \(\gamma\) value and the column index identifies a \(\beta\) value.

for row, gamma in enumerate(gamma_values):
    for column, beta in enumerate(beta_values):
        result = simulate_sir(beta, gamma)
        peak_grid[row, column] = result["peak_I"]
  • A loop inside another loop is a nested loop.
  • enumerate(values) supplies both an index and its corresponding value.
  • peak_grid[row, column] selects one cell in the two-dimensional array.

Local normalized sensitivity

For parameter \(p\) and outcome \(Y\), we estimate a local sensitivity using a small increase and decrease around the baseline:

\[S_p^Y\approx\frac{Y(p+\Delta p)-Y(p-\Delta p)}{2\Delta p}\frac{p}{Y(p)}.\]

This is dimensionless. A value near 1 means that, locally, a 1% parameter increase is associated with approximately a 1% outcome increase. A negative value means the outcome moves in the opposite direction.

This interpretation is local and approximate. It applies near the chosen baseline and for the selected perturbation size.

Absolute versus normalized sensitivity

MeasureApproximate formInterpretation
Absolute sensitivity\(\Delta Y/\Delta p\)Outcome-unit change per parameter-unit change; its numerical size depends on units.
Normalized sensitivity\((\Delta Y/Y)/(\Delta p/p)\)Percentage outcome change per percentage parameter change; dimensionless and easier to compare.

Program the finite-difference calculation

change_fraction = 0.05
delta_beta = change_fraction * beta_baseline

outcome_plus = model(beta_baseline + delta_beta)
outcome_minus = model(beta_baseline - delta_beta)

derivative = (
    outcome_plus - outcome_minus
) / (2 * delta_beta)

sensitivity = (
    derivative * beta_baseline / outcome_baseline
)

A 5% change is used on each side of the baseline. The central difference uses both sides and is generally more balanced than a one-sided comparison.

Run the complete multi-scenario sensitivity experiment

Interactive PythonSIR parameter experiments

Output

Run the code to see the result.

New programming tools

CodePurpose
np.zeros((rows, columns))Creates a two-dimensional numerical array.
enumerate(values)Returns each item together with its index.
elifTests another condition when the preceding if condition was false.
zip(a, b)Pairs corresponding entries from two collections.
[a if condition else b for value in values]A list comprehension that creates one result for every value, choosing between two alternatives.
np.round(array, 2)Rounds displayed values to two decimal places without changing the original array.
imshow(matrix)Displays a two-dimensional array as a colour image.
fig.colorbar(...)Adds a scale explaining how colours correspond to numerical values.

Extra scenario: sensitivity to intervention timing

Suppose transmission falls from \(\beta=0.30\) to \(\beta=0.12\) on an intervention day \(T_L\). We now treat \(T_L\) as the input being varied.

\[T_L\in\{10,20,30,40,50,60,70\}\quad\text{days}.\]

This scenario is useful because timing can have a nonlinear effect. Delaying an early intervention may strongly increase the peak, while delaying an intervention until after the uncontrolled peak may make little further difference to that peak.

InputOutputsQuestion
Intervention day \(T_L\)Peak infectious population and final epidemic sizeHow rapidly is benefit lost as intervention is delayed?

Interpret the results carefully

Positive sensitivity

The outcome increases locally as the parameter increases. Transmission commonly has a positive effect on peak size near an epidemic baseline.

Negative sensitivity

The outcome decreases locally as the parameter increases. Faster recovery commonly reduces infectious burden.

The magnitude ranks local responsiveness only for the chosen model, baseline, outcome and perturbation. A small local sensitivity does not prove that a parameter is unimportant everywhere.

Sensitivity is not uncertainty

Sensitivity analysisUncertainty analysis
Asks how outputs respond when inputs change.Asks how uncertain inputs produce uncertainty in outputs.
Can use deliberately chosen parameter changes.Requires assumptions or evidence about plausible parameter distributions or ranges.
Does not assign probabilities to parameter values.May propagate probability distributions through the model.

Neither sensitivity nor scenario comparison establishes that changing a real-world factor will cause exactly the modelled outcome. Conclusions remain conditional on the model structure and parameter interpretation.

Try changing the perturbation size

First change change_fraction=0.05 to 0.01 and then to 0.20. Next extend intervention_days to include days 80 and 100.

  1. Compare the sensitivity estimates.
  2. Identify which estimates remain stable.
  3. Explain why a 20% change is less “local” than a 1% change.
  4. Discuss whether one derivative-like number can summarise a strongly nonlinear response.