Section 18.2.11

Figure 8b: stacked step medians and non-additive summaries

Definition

A stacked bar of step medians §11.13 is a bar made of segments piled up, one per step of an operation, each as high as that step’s median duration over many runs. The median is the middle value of the sorted durations. A non-additive summary is a summary (one number that describes many measurements) whose value for a total is in general not the sum of its values for the parts. The median is non-additive, so the pile’s height is in general not the median duration of the whole operation.

Where it fits

Main entry: Median (§11.13).

The median entry explains that a median is found by position in a sorted list, not by adding. A stacked bar invites the reader to add its segments, and for medians that sum is in general not the median of the whole operation. A careful figure therefore prints the median of the per-run totals as a label above the bar.

The pile can be too high as well as too low. Let step A take 0, 10 and 10 milliseconds (ms) in three runs and step B take 10, 10 and 0 ms in the same runs. The totals are 0+10=100 + 10 = 10, 10+10=2010 + 10 = 20 and 10+0=1010 + 0 = 10 ms, and their median is 10 ms. Both step medians are 10 ms, so the pile is 10+10=2010 + 10 = 20 ms high. The answer below shows a pile that is too low.

Read each segment as a statement about its own step, and read the total from the label. All data in this entry’s examples are invented.

Limits and common mistakes

A segment divided by the label is not the typical share of that step. In the example above, the segment of step A (10 ms) equals the label (10 ms), which suggests a share of 100%. Yet step A makes up 0%, 50% and 100% of the three totals, and the median of those shares is 50%.

Steps can rest on different numbers of runs, for instance when a step was not recorded in some runs. Then even means need not add up to the mean total.

A label that is the sum of the step medians must not be called the median total.

Questions answered

Does the top label have to equal the bar height?

No: the top label of a stacked bar does not have to equal the height of the bar. A stacked bar is made of segments piled on one another, here one segment per step of an operation, and the top label is the number printed above the bar. The two are certain to be equal only when the summary that the bar shows, the one number that stands for many runs, is additive, meaning that its value for a total is the sum of its values for the parts. If each segment is the median duration of one step and the label is the median of the per-run totals, the two can differ, because a median is the middle value of a sorted list and the middle values of two steps can come from different runs.

Let step A take 0, 0 and 100 milliseconds (ms) in three runs and step B take 100, 0 and 0 ms in the same runs. Both step medians are 0 ms, so the bar has no height. The totals are 0+100=1000 + 100 = 100, 0+0=00 + 0 = 0 and 100+0=100100 + 0 = 100 ms, and their median is 100 ms.

Two kinds of bar do add up. The first is a bar of means in which every step is averaged over the same runs: here both means are 100/3100/3 ms, their sum is 200/3200/3, about 66.7 ms, and that is also the mean of the three totals. The second is a bar that shows the steps of a single run. The caption must therefore say which summary the segments use and which the label uses.

Related entries: Sample mean (§11.12), Ratio of aggregates versus aggregate of ratios (§11.40), Measurement perturbation (§13.30), Mean, median, and the chosen performance question (§18.1.8), Paired differences versus differences of medians (§18.1.14).