Rank one-factor-at-a-time output changes around a reproducible baseline without mistaking a wide input range for causal importance.
Tornado charts: keep scenario ranges attached to their assumptions
Start at a reproducible base case
A tornado chart compares how a model output changes when each input is moved to a declared low and high scenario while every other input stays at its baseline. Write down the model version, baseline inputs, output unit and evaluation date first. The central line is the base-case output, not automatically zero. A bar may extend mainly to one side if the output response is asymmetric. Keep the low-input and high-input labels with their actual output values; for a cost input, increasing the input may move profit left instead of right. Diverging bars explain signed changes, but a tornado's reference is an output produced by a specific model state.
Make ranges comparable before sorting
The width of a sensitivity bar depends on both the model and the tested range. Comparing an input moved by 47 percent with another moved by 2 percent and calling the wider result 'more important' confuses scenario design with model sensitivity. Use justified low and high bounds such as operational limits or prespecified uncertainty ranges, and print them in a table. Sort bars by a declared measure, such as maximum absolute movement from the base case; retain a stable secondary order for ties. If different input units matter, a percentage change can help explain the scenario but must be defined even when the baseline is zero. Axis integrity requires one output scale across all rows.
Do not present one-factor variation as a forecast
One-factor-at-a-time bars hold other inputs fixed. They miss interactions: a lower order count and a lower margin together may hurt more than either separate bar suggests. They also ignore correlations and the probability of a scenario. A bar should not be read as a confidence interval or as the expected range of outcomes. Show combined scenarios separately when constraints tie inputs together, and use an uncertainty method suited to the actual model if probability statements are needed. Forecast bands encode a different claim. Interval labels help prevent scenario ranges from masquerading as statistical error bars.
Audit the model calls behind the picture
Evaluate the base case once and each low and high scenario with all other inputs unchanged. Store every exact input vector and output before sorting for display; otherwise a later reader cannot reproduce why a bar moved. Validate that the baseline lies within each scenario's declared range, and reject nonfinite model results. Include the actual input units and whether a low scenario means 'better' or simply a smaller number. For crowded dashboards, show the largest few bars with a link or table containing the rest instead of silently dropping variables. An export manifest can retain input range, model revision and ordering rule. A clear table is also a text alternative to colored bars.
Worked contract
from math import isfinite
def margin_model(inputs: dict[str, float]) -> float:
return inputs["weekly_orders"] * inputs["unit_margin"] - inputs["fixed_cost"]
def tornado_ledger(baseline: dict[str, float],
bounds: dict[str, tuple[float, float]]):
if set(baseline) != set(bounds) or not baseline or any(
not isfinite(value) for value in baseline.values()):
raise ValueError("every finite baseline input needs one scenario range")
base_output = margin_model(baseline)
rows = []
for name, (low, high) in bounds.items():
if (not isfinite(low) or not isfinite(high) or
low > baseline[name] or high < baseline[name]):
raise ValueError("scenario must bracket its baseline input")
low_case = dict(baseline)
high_case = dict(baseline)
low_case[name] = low
high_case[name] = high
low_output = margin_model(low_case)
high_output = margin_model(high_case)
if not isfinite(low_output) or not isfinite(high_output):
raise ValueError("model result is not finite")
impact = max(abs(low_output - base_output),
abs(high_output - base_output))
rows.append((name, low, high, low_output, high_output, impact))
rows.sort(key=lambda row: (-row[-1], row[0]))
return base_output, rows
base_inputs = {"weekly_orders": 47.0, "unit_margin": 83.0,
"fixed_cost": 1700.0}
scenario_bounds = {"weekly_orders": (42.0, 52.0),
"unit_margin": (74.0, 92.0),
"fixed_cost": (1500.0, 1900.0)}
baseline_output, rows = tornado_ledger(base_inputs, scenario_bounds)
assert baseline_output == 2201.0
assert [row[0] for row in rows] == ["unit_margin", "weekly_orders", "fixed_cost"]
assert rows[0][3:6] == (1778.0, 2624.0, 423.0)
assert rows[-1][3:5] == (2401.0, 2001.0)Performance and operating cost
For P inputs and model-evaluation cost C, the base plus two scenarios per input take O(P·C) model time; copying P-element input maps for each scenario also costs O(P²) in this small standard-library implementation. The row list is O(P) space, with O(P) temporary space per call. The worked weekly margin model returns base output 2,201, correctly orders the three tested ranges and shows that lower fixed cost raises profit. For expensive models, keep the same scenario contract while avoiding unnecessary full-map copies in the evaluation adapter.
Common Mistakes
- Calling the longest bar the most important variable without comparing the ranges tested.
- Assuming low input always produces the left endpoint of the output bar.
- Reading one-factor-at-a-time scenarios as joint uncertainty or prediction intervals.
- Sorting a published tornado by a new rule without preserving scenario values and model version.
Validation drill
For a synthetic service operation, freeze 47 weekly orders and a 2,201-unit base margin. Evaluate every low and high scenario independently, add one combined worst-case scenario to expose interactions, and give readers an exact input-output table beside the sorted bars.
