Global Sensitivity Analysis
Global sensitivity analysis (GSA) attributes the variation in a model’s output to its uncertain inputs. It answers “which knobs actually matter?” — essential for prioritizing data collection, simplifying models, and communicating which epidemiological parameters drive a forecast.
Local vs global
Local sensitivity looks at partial derivatives at a single nominal point, a one-at-a-time (OAT) view. It is cheap but only describes the neighborhood of , ignores interactions, and depends on the (arbitrary) units and base point. See partial derivatives.
Global sensitivity varies all inputs across their full uncertainty ranges simultaneously, treating the inputs as random variables and studying how the output responds over the whole space. The input designs are typically generated by Latin Hypercube Sampling.
Morris elementary-effects screening
The Morris method is a cheap global screening method. It computes elementary effects along one-at-a-time steps but from many randomly scattered starting points: Over many trajectories, the mean of (denoted ) ranks overall importance, while the standard deviation flags nonlinearity and interactions. It uses few runs, so it is used to discard unimportant inputs before a more expensive analysis.
Variance-based Sobol indices
Sobol indices decompose the output variance by inputs. Using the law of total variance (see measures of variability):
The first-order index measures the variance explained by alone:
The total-effect index measures all variance involving , including every interaction it participates in: where denotes all inputs except .
Interpretation:
- , with equality only when the model is purely additive (no interactions).
- Always , and quantifies ’s involvement in interactions.
- means can be safely fixed.
Worked example
Let with independent, each , so and .
Condition on and take the expectation over (mean ): Its variance is .
For the total variance, add the residual term . Given , , so and . Hence so . The remaining () is the pure interaction term , so each input’s total effect is . Both inputs matter equally, and a small but nonzero share is interaction.
In code
R
# install.packages(c("sensitivity", "boot"))
library(sensitivity)
set.seed(1)
f <- function(X) X[, 1] + X[, 2] + X[, 1] * X[, 2]
n <- 10000
X1 <- data.frame(x1 = runif(n), x2 = runif(n))
X2 <- data.frame(x1 = runif(n), x2 = runif(n))
s <- sobolSalt(model = f, X1, X2, scheme = "A", nboot = 100)
print(s) # First-order S_i ~ 0.49 each; total S_Ti ~ 0.51 each
# Morris screening:
m <- morris(model = f, factors = c("x1", "x2"), r = 50,
design = list(type = "oat", levels = 6, grid.jump = 3))
print(m) # mu.star ranks importance
Python
import numpy as np
from SALib.sample import sobol as sobol_sample
from SALib.analyze import sobol
np.random.seed(0)
problem = {"num_vars": 2, "names": ["x1", "x2"],
"bounds": [[0, 1], [0, 1]]}
X = sobol_sample.sample(problem, 1024) # Saltelli design
Y = X[:, 0] + X[:, 1] + X[:, 0] * X[:, 1]
Si = sobol.analyze(problem, Y)
print(Si["S1"]) # ~ [0.49, 0.49]
print(Si["ST"]) # ~ [0.51, 0.51]
Julia
using GlobalSensitivity, Statistics, Random
Random.seed!(0)
f(x) = x[1] + x[2] + x[1] * x[2]
bounds = [[0.0, 1.0], [0.0, 1.0]]
res = gsa(f, Sobol(order = [0, 1]), bounds; samples = 10_000)
println(res.S1) # first-order ~ [0.49, 0.49]
println(res.ST) # total-effect ~ [0.51, 0.51]
Why it matters for statistics
GSA turns “uncertainty in the inputs” into a ranked, quantitative statement about “uncertainty in the output.” Sobol indices give a variance decomposition that is model-free (no linearity assumption), captures interactions, and is directly interpretable as a fraction of output variance. In epidemiology this tells you whether a forecast’s spread is driven by , by reporting rates, or by their interaction — guiding which parameters to measure more precisely.