The Central Idea

A parameter sweep treats model runs as a structured experiment.

The basic pattern is

\[ \boxed{ \text{choose parameter values} \longrightarrow \text{run model repeatedly} \longrightarrow \text{compare outputs} }. \]

The goal is not merely to produce more simulations. It is to learn how the model responds across a defined parameter space.

What Is a Parameter?

A parameter is a model quantity treated as fixed during one simulation but allowed to vary between simulations.

Examples include:

What Is a Parameter Sweep?

A parameter sweep is a systematic collection of simulation runs in which one or more parameters are varied across predetermined values.

If a model output is

\[ Y=F(\theta), \]

then a one-parameter sweep evaluates

\[ F(\theta_1),\quad F(\theta_2),\quad \ldots,\quad F(\theta_m). \]

The resulting outputs reveal how \(Y\) depends on \(\theta\).

Why Sweep Parameters?

Parameter sweeps can reveal:

One-Parameter Sweep

The simplest sweep varies one parameter while all others are held fixed.

Suppose

\[ \theta\in\{0.1,0.2,0.3,0.4,0.5\}. \]

The model is run once or repeatedly at each of these five settings.

Plotting output versus \(\theta\) can reveal trends, curvature, plateaus, and thresholds.

Example: Growth Rate Sweep

Consider

\[ \frac{dP}{dt}=rP \]

with fixed initial condition \(P_0\).

A sweep might evaluate

\[ r\in\{0.01,0.02,0.03,0.04,0.05\}. \]

For each value of \(r\), record the population at a chosen final time.

The resulting curve shows how strongly the final population depends on the growth parameter.

Choosing the Sweep Range

A sweep requires a lower and upper parameter bound.

For example,

\[ \theta_{\min}\le\theta\le\theta_{\max}. \]

The range should reflect the modeling purpose and may come from:

Uniform Parameter Spacing

A common sweep uses equally spaced values:

\[ \theta_j = \theta_{\min} + j\Delta\theta, \]

where

\[ \Delta\theta = \frac{ \theta_{\max}-\theta_{\min} }{m-1}. \]

This is straightforward to construct and interpret.

Example: Uniform Sweep

Sweep

\[ 0\le\theta\le1 \]

using six equally spaced values.

Then

\[ \Delta\theta = \frac{1-0}{5} = 0.2. \]

The values are

\[ \boxed{ 0,\ 0.2,\ 0.4,\ 0.6,\ 0.8,\ 1 }. \]

Logarithmic Sweeps

If a parameter spans several orders of magnitude, equal linear spacing may be inefficient.

A logarithmic sweep might use

\[ 10^{-3},\quad 10^{-2},\quad 10^{-1},\quad 10^0,\quad 10^1. \]

This is useful for parameters such as rates, conductivities, tolerances, or scale factors that may vary multiplicatively.

Coarse-to-Fine Sweeps

A practical strategy is to begin with a coarse sweep to locate interesting regions.

Suppose a transition appears between

\[ \theta=0.4 \]

and

\[ \theta=0.5. \]

A refined sweep can then focus on

\[ 0.40,\ 0.42,\ 0.44,\ldots,0.50. \]

This uses computational effort where it provides the most information.

Two-Parameter Sweeps

Suppose a model depends on parameters \(a\) and \(b\).

Choose

\[ a\in\{a_1,\ldots,a_m\} \]

and

\[ b\in\{b_1,\ldots,b_n\}. \]

A full grid evaluates every pair

\[ (a_i,b_j). \]

Number of Runs in a Two-Parameter Grid

If there are \(m\) values of \(a\) and \(n\) values of \(b\), then a full sweep requires

\[ \boxed{ mn } \]

model configurations.

For

\[ m=8,\qquad n=10, \]

the sweep contains

\[ 8\cdot10=\boxed{80} \]

configurations.

Three or More Parameters

The number of runs grows rapidly with dimension.

If parameter \(k\) has \(m_k\) sampled values, then a full Cartesian sweep requires

\[ \boxed{ N_{\text{runs}} = \prod_{k=1}^{d}m_k }. \]

This rapid growth is sometimes called the curse of dimensionality.

Example: Dimensional Growth

Suppose five parameters each use ten values.

A full grid requires

\[ 10^5 = \boxed{100{,}000} \]

parameter combinations.

If each configuration requires repeated stochastic trials, the total number of simulations becomes even larger.

Stochastic Parameter Sweeps

If the model is stochastic, one run at each parameter setting is usually insufficient.

Suppose each configuration is repeated \(R\) times.

Then a sweep with \(M\) parameter combinations requires

\[ \boxed{ MR } \]

simulation runs.

Example: Repeated Sweep

A two-parameter sweep contains

\[ 60 \]

configurations.

If each is repeated

\[ 25 \]

times, the total number of simulation runs is

\[ 60\cdot25 = \boxed{1500}. \]

What Should Be Recorded?

Each run should store enough information to connect the output to its input configuration.

A useful record may include:

Run Tables

Parameter sweeps are naturally organized as tables.

A simple output table may contain columns such as:

Well-structured tables make later visualization and analysis much easier.

Sensitivity Curves

For a one-parameter sweep, plot

\[ Y(\theta) \]

against \(\theta\).

The slope indicates how strongly the output changes locally:

\[ \frac{dY}{d\theta}. \]

A steep region indicates greater sensitivity than a flat region.

Finite-Difference Sensitivity

If only sweep data are available, a local sensitivity can be approximated by

\[ \boxed{ \frac{\Delta Y}{\Delta\theta} = \frac{ Y(\theta+\Delta\theta)-Y(\theta) }{\Delta\theta} }. \]

This estimates how much the output changes per unit change in the parameter.

Relative Sensitivity

Parameters with different units or scales may be compared using dimensionless relative sensitivity.

A common form is

\[ \boxed{ S = \frac{\theta}{Y} \frac{dY}{d\theta} }. \]

This describes the fractional change in output associated with a fractional change in the parameter.

Heat Maps

A two-parameter sweep is often summarized with a heat map.

The horizontal axis represents one parameter, the vertical axis represents another, and the displayed value represents an output:

\[ Y=F(a,b). \]

Heat maps make broad response regions and transitions easy to see.

Response Surfaces

A two-parameter model output can also be viewed as a surface:

\[ z=F(a,b). \]

Peaks, valleys, ridges, plateaus, and steep transition zones help characterize the model's response structure.

Contour Maps

A contour plot connects parameter combinations that produce approximately equal output.

A contour satisfies

\[ F(a,b)=c \]

for a fixed value \(c\).

Contours are useful for identifying tradeoffs between parameters.

Thresholds

A model may change behavior when a parameter crosses a critical value.

For example,

\[ Y(\theta) \]

may remain small until

\[ \theta\approx\theta_c, \]

then increase sharply.

Parameter sweeps help locate such thresholds.

Phase-Like Transitions

Some models exhibit qualitatively different regimes in different parts of parameter space.

One region may produce:

Mapping these regions produces a computational regime or phase diagram.

Regime Classification

Instead of recording a continuous output, a sweep can classify each run.

For example,

\[ C(a,b) \in \{ \text{stable}, \text{oscillatory}, \text{divergent} \}. \]

This is especially useful when qualitative behavior is more important than one numerical statistic.

Robust Regions

A robust region is a portion of parameter space where the model produces similar acceptable behavior across many nearby settings.

Robust regions are often more useful than isolated optimal points because small uncertainty in parameters is less likely to change the conclusion.

Fragile Regions

A fragile region is one in which a small parameter change causes a large output change.

Such regions may require:

Interaction Effects

Two parameters may affect the model jointly rather than independently.

If

\[ Y=F(a,b), \]

then the effect of changing \(a\) may depend on the current value of \(b\).

A one-parameter-at-a-time sweep may miss such interactions.

One-at-a-Time Sweeps

A common approach varies one parameter while keeping all others fixed at baseline values.

This is easy to interpret but has an important limitation:

it explores only coordinate directions through parameter space and may miss combined effects.

Full Factorial Sweeps

A full factorial sweep evaluates every combination of the selected parameter levels.

This captures interactions more completely than one-at-a-time sweeps.

The drawback is rapid growth in computational cost as the number of parameters and levels increases.

Sampling Parameter Space

When full grids are too expensive, parameter combinations can be sampled rather than exhaustively enumerated.

Possible strategies include:

Random Parameter Sampling

Parameters may be sampled from distributions:

\[ \boldsymbol{\theta} \sim p(\boldsymbol{\theta}). \]

This approach connects parameter sweeps with Monte Carlo uncertainty analysis.

It is especially useful when parameter uncertainty is naturally probabilistic.

Latin Hypercube Idea

Latin hypercube sampling divides each parameter range into intervals and ensures that each interval is sampled.

Compared with simple random sampling, this can provide more even coverage of a multi-parameter space using the same number of runs.

Adaptive Parameter Sweeps

An adaptive sweep chooses later parameter values based on earlier results.

For example:

  1. run a coarse sweep;
  2. identify rapid transitions;
  3. insert additional parameter points there;
  4. repeat until the region is resolved adequately.

This avoids spending equal effort everywhere.

Optimization Versus Sweeping

A parameter sweep explores behavior across many settings.

Optimization searches for settings that maximize or minimize an objective.

A sweep may reveal the broader landscape before an optimization method is applied.

These approaches are related but serve different purposes.

Calibration Versus Sweeping

Calibration seeks parameter values that match data.

A sweep explores how model outputs change across parameter values.

Parameter sweeps can support calibration by showing which regions of parameter space produce acceptable agreement with observations.

Feasible Parameter Regions

Some parameter combinations may violate physical, numerical, or logical constraints.

If a model requires

\[ a+b\le1, \]

then not every pair in a rectangular sweep is feasible.

Invalid combinations should be excluded or clearly marked.

Numerical Failure Regions

A parameter sweep may reveal regions where the numerical method fails.

Symptoms can include:

These failures are important outputs and should not simply be discarded.

Separating Model Behavior from Numerical Behavior

If a run fails at a particular parameter setting, determine whether the cause is:

Verification remains important throughout parameter exploration.

Parallel Computation

Many parameter-sweep runs are independent.

Therefore, they can often be executed in parallel across:

Parameter sweeps are a natural example of embarrassingly parallel computation.

Runtime Estimation

If one simulation takes approximately \(T\) seconds and the sweep requires \(N\) independent runs, serial runtime is approximately

\[ \boxed{ T_{\text{total}} \approx NT }. \]

This simple estimate helps determine whether a proposed sweep is computationally practical.

Storage Cost

Parameter sweeps can also produce large amounts of data.

If each run stores \(S\) bytes and there are \(N\) runs, then total storage is

\[ \boxed{ S_{\text{total}} = NS }. \]

Saving only the outputs required for later analysis can greatly reduce storage.

Summary Statistics Versus Full Trajectories

A sweep does not always need to save every state at every time step.

It may be sufficient to record:

Output design should reflect the questions the sweep is intended to answer.

Reproducible Sweep Configuration

A sweep should be defined by a clear configuration that records:

Without this information, repeating the same computational experiment may be difficult.

Common Error: Sweeping an Implausible Range

A parameter sweep can produce attractive plots across values that have no physical or empirical meaning.

Parameter ranges should be justified or clearly identified as hypothetical stress tests.

Common Error: Using Too Coarse a Sweep

Widely spaced parameter values can miss narrow transitions or local extrema.

A coarse sweep is useful for exploration, but interesting regions should be refined.

Common Error: Using Too Fine a Sweep Everywhere

Extremely fine spacing across an entire large parameter space can waste enormous computational effort.

Coarse-to-fine and adaptive strategies are often more efficient.

Common Error: Ignoring Parameter Interactions

One-at-a-time sweeps can miss behavior caused by combinations of parameters.

If interactions are plausible, multi-parameter exploration should be included.

Common Error: Comparing Stochastic Runs Directly

Two parameter settings should not be judged from one random run each.

Repeated trials and statistical summaries are needed to distinguish parameter effects from random variation.

Common Error: Losing Run Metadata

A result without its parameter settings, seed, and model version may be impossible to interpret later.

Every output should remain traceable to the configuration that produced it.

Common Error: Treating Numerical Failure as Missing Data

Failed simulations may identify important regions of parameter space.

Record failure type and configuration rather than silently deleting the run.

A Reliable Parameter-Sweep Workflow

  1. Identify the model parameters of interest.
  2. Define justified ranges or distributions.
  3. Choose linear, logarithmic, sampled, or adaptive parameter values.
  4. Specify one-parameter or multi-parameter combinations.
  5. Determine the number of stochastic repetitions.
  6. Estimate computational and storage cost.
  7. Define outputs and failure indicators before running.
  8. Assign unique run identifiers and seeds.
  9. Execute the runs systematically.
  10. Store parameter settings with every output.
  11. Visualize response curves, surfaces, maps, or regime classes.
  12. Refine interesting or sensitive regions.
  13. Distinguish model transitions from numerical failures.
  14. Document the entire experiment for reproducibility.

Practice 1: Uniform Sweep

Sweep

\[ 0\le\theta\le2 \]

using five equally spaced values.

List the parameter values.

Practice 2: Two-Parameter Run Count

Parameter \(a\) has \(6\) tested values and parameter \(b\) has \(8\) tested values.

How many configurations are in the full grid?

Practice 3: Repeated Stochastic Runs

A sweep contains \(48\) parameter configurations, each repeated \(20\) times.

How many total simulation runs are required?

Practice 4: High-Dimensional Sweep

Four parameters each use \(5\) levels.

How many combinations are in a full factorial sweep?

Practice 5: Local Sensitivity

A model output changes from

\[ Y=10 \]

at

\[ \theta=2 \]

to

\[ Y=13 \]

at

\[ \theta=2.5. \]

Estimate \(\Delta Y/\Delta\theta\).

Practice 6: Coarse-to-Fine Strategy

A coarse sweep reveals a sharp transition between \(\theta=0.7\) and \(\theta=0.8\).

What should the next sweep do?

Practice 7: Interaction Effect

The influence of parameter \(a\) changes dramatically depending on the value of parameter \(b\).

What does this indicate?

Practice 8: Failed Runs

Several configurations produce numerical divergence.

Should those configurations simply be deleted from the sweep results?

Practice Answers

Practice 1

There are four equal intervals, so

\[ \Delta\theta = \frac{2}{4} = 0.5. \]

The values are

\[ \boxed{ 0,\ 0.5,\ 1.0,\ 1.5,\ 2.0 }. \]

Practice 2

\[ 6\cdot8 = \boxed{48}. \]

Practice 3

\[ 48\cdot20 = \boxed{960}. \]

Practice 4

\[ 5^4 = \boxed{625}. \]

Practice 5

\[ \frac{\Delta Y}{\Delta\theta} = \frac{13-10}{2.5-2} = \frac{3}{0.5} = \boxed{6}. \]

Practice 6

Refine the parameter spacing inside the interval from \(0.7\) to \(0.8\) to locate and characterize the transition more precisely.

Practice 7

The parameters interact. The effect of one parameter depends on the setting of the other, so one-at-a-time analysis may be inadequate.

Practice 8

No. Record the failed configurations and investigate whether the cause is numerical instability, an invalid parameter combination, a model singularity, or an implementation error.

What to Remember

Parameter sweeps turn repeated model runs into a structured exploration of model behavior.

The central principle is: vary parameters systematically, record the resulting behavior faithfully, and use the full response landscape rather than one isolated model run.

Where We Go Next

A parameter sweep may generate hundreds, thousands, or millions of model runs. Those results are useful only if the computational experiment can be reconstructed, checked, and repeated.

The next lesson, Reproducibility, develops the practices needed to preserve model versions, inputs, parameters, random seeds, software environments, run metadata, and computational workflows so that results can be reproduced reliably.