Section 11.46

Sensitivity analysis

Definition

Sensitivity analysis is the practice of repeating an analysis under other defensible choices or assumptions, such as another weighting, time window, exclusion rule or uncertainty method, and reporting how the result and the conclusion change. A conclusion that holds under every alternative is called robust to those alternatives; one that changes reveals the choice it depends on. Sensitivity analysis differs from a search for a favorable result: its alternatives are justified, chosen where possible before the results are seen, and all reported.

The idea

An experiment compares the response time §9.32 of a server before and after a software change, using requests from two client devices. Device A sends 100 requests, and each becomes 0.2 milliseconds faster. Device B sends one request, and it becomes 1 millisecond slower. Averaged over requests, the change makes responses faster. Averaged over devices, it makes them slower. A report that shows only one of these numbers hides that its conclusion depends on a choice the analyst made.

Every analysis rests on such choices: which events count, how they are weighted, which time window is used, which values are excluded as faulty, how missing results are treated and how uncertainty is computed. Sensitivity analysis makes those choices visible. It changes them, recomputes the same comparison and sets the results side by side. An engineer who checks a bridge design under several loads, not only the expected one, learns which load decides whether the bridge holds. The picture stops being accurate in one respect: the loads on a bridge are facts about the world, whereas many analysis choices decide which question is asked, so two different answers can both be right.

How it works

  1. Name the primary analysis and the question it answers, before looking at the results.

  2. List the choices that a careful analyst could defensibly have made differently, each with its alternatives and a reason. Common ones are the weighting or unit of analysis, the time window, the warmup §11.27 cut-off, the exclusion and outlier §11.31 rules, the treatment of failures and timeouts §9.34, the statistical model and the uncertainty method.

  3. Classify each alternative.

    • It changes the estimand §11.2, the quantity the question asks for: equal weight per device instead of per request, or a window that admits different events. The result may change because the question changed.

    • It keeps the estimand and changes the estimator or the uncertainty method, for example a cluster bootstrap §11.21 that resamples whole devices instead of single requests. The estimate often stays the same while the confidence interval §11.18 widens or narrows.

    • It changes an assumption about something not observed, such as the response times of requests that timed out.

  4. Recompute the same declared comparison under each alternative, one choice at a time, and in combination where choices interact.

  5. Report all results together in one table, mark the primary one, and explain each difference by its class.

  6. State the dependence. Call the conclusion robust if it is the same under every alternative. Otherwise name the choice that reverses it. For an assumption about unobserved values, give the tipping point: the least extreme value of the assumption that reverses the conclusion.

Running every combination of the choices at once, and showing all the results, is known as a multiverse analysis.

Worked example

Each of device A’s 100 requests takes 1.0 milliseconds (ms) before the change and 0.8 ms after it, a change of 0.8−1.0=−0.20.8 - 1.0 = -0.2 ms. Device B’s single request takes 1.0 ms before and 2.0 ms after, a change of 2.0−1.0=+1.02.0 - 1.0 = +1.0 ms. Three analyses give:

The sign of the result depends on the weighting: requests are faster on average, but the average device is slower. Neither is an error. They answer different questions, and the question the study set out to answer decides which is primary. The exclusion rule deserves suspicion: it removes exactly the one observation that showed a slowdown. Unless the 1.5 ms limit was fixed for a stated reason before the data were seen, it is a choice that fits the outcome.

A tipping point makes the dependence concrete. Under the per-request analysis, let xx be the change of B’s request, in milliseconds, that would make the overall change zero. Solving 100×(−0.2)+x=0100 \times (-0.2) + x = 0 gives x=20x = 20 ms. B’s request would have to slow down by 20 ms, twenty times the slowdown observed, before the per-request conclusion reversed.

Stated precisely

Let CC be the declared set of analysis choices and cc one member of it. Let θ̂(c)\hat{\theta}(c) (theta-hat of cc) be the estimate that choice cc produces, and θ(c)\theta(c) the estimand that choice cc targets. A sensitivity analysis reports θ̂(c)\hat{\theta}(c) for every c∈Cc \in C, where ∈\in means “is a member of”, together with the reason for each cc. A conclusion, such as “the change reduces response time”, is robust over CC when it holds for every c∈Cc \in C. In the example, CC has three members with estimates −0.188-0.188, +0.4+0.4 and −0.2-0.2 ms, so the conclusion is not robust over CC.

Write maxcθ̂(c)\max_c \hat{\theta}(c) and mincθ̂(c)\min_c \hat{\theta}(c) for the largest and the smallest estimate over the choices. Their difference, here 0.4−(−0.2)=0.60.4 - (-0.2) = 0.6 ms, is not a confidence interval. A confidence interval describes the sampling uncertainty of one estimator for one estimand. The spread across choices mixes different estimands and different analysis decisions, and no probability statement attaches to it.

Robustness holds only relative to CC. A choice that every member of CC shares, such as the clock used for all timings, is not tested by it.

Limits and common mistakes

Agreement across alternatives cannot reveal an error they all share: a wrong clock, a mismeasured endpoint, or failures that never entered the data. Sensitivity analysis complements sound design and measurement; it does not replace them.

Trying many analyses and reporting the favorable one is the opposite of sensitivity analysis. Each extra analysis is another chance of a finding that is due to chance, the problem the multiple comparisons §11.26 entry treats. Report every alternative that was run.

Alternatives are not votes. Three analyses that agree and one that disagrees do not make a 3 to 1 result, because the disagreeing one may be the one that answers the question. For the same reason, do not average the alternative estimates into one number: they can target different estimands.

An alternative that changes the estimand does not show a lack of robustness. It shows that two questions have different answers. Say which question the claim is about.

Exclusion rules fixed before the data are seen, called prospective exclusion rules §13.15, belong to the primary analysis. Rules invented afterwards belong in a sensitivity analysis, labeled as such.

The name has a second use in modeling and engineering: measuring how much a model’s output changes when one of its inputs changes, for example through the partial derivative of the output with respect to each input (the rate at which the output changes as that one input changes), or through the share of the output’s variance §11.14 that each input accounts for. That kind tests a model’s inputs; the kind in this entry tests an analyst’s choices. Both identify the assumptions a conclusion leans on.

Questions answered

Does the conclusion change under another clustering, window, or exclusion rule?

It can, and the only way to know is to recompute the same comparison under each defensible alternative and report every result, which is what a sensitivity analysis does. The three kinds of change act differently.

If the conclusion keeps its direction and practical meaning under every alternative, report it as robust to those alternatives. If it changes, report that it depends on the choice, say which question each analysis answers, and keep as primary the analysis that answers the question the study was designed to ask. For example, 100 requests that each become 0.2 milliseconds faster and 1 request that becomes 1 millisecond slower give a per-request change of about −0.19-0.19 milliseconds but a per-device change of +0.4+0.4 milliseconds.

Related entries: Estimand and estimator (§11.2), Cluster bootstrap (§11.21), Multiple comparisons (§11.26), Outlier handling (§11.31), Missing data and attrition (§11.29), Prospective exclusion rule (§13.15).