Sub topic 7
Summarizing time data: skew, medians, and geometric means
This chapter assumes you can compute a mean, a median, and a percentage. It also assumes you have already collected time on task, as covered in the previous chapter, and that you can read short Python programs. A basic idea of what a confidence interval is will help in the last section, but you do not need it to follow the rest.
Why time data needs special handling
Time on task is the number of seconds a participant takes to finish a task. It looks like simple data, so most people summarize it with an average. That often gives a misleading number.
Task times are right-skewed. This means most people finish in a fairly narrow range, while a few people take much longer. Times have a hard floor, because nobody finishes in zero or negative seconds. They have no ceiling, because a confused participant can keep working for minutes. The result is a distribution with a short left side and a long right tail.
The arithmetic mean is pulled toward that tail. One participant who takes 120 seconds when everyone else takes about 40 raises the mean noticeably, even though most people did not experience a slow task. A summary that describes almost nobody in your sample is a poor summary.
Use successful attempts only
Before choosing a summary, decide which attempts to include. The standard practice is to summarize time only for participants who completed the task successfully.
A failed attempt has no meaningful time. A participant who gave up after 20 seconds did not complete the task quickly. A participant who ran into a time limit did not complete it slowly. Mixing those values with successful times produces a number that does not measure efficiency.
Report the number of successful attempts next to every time summary. If only 6 of 10 people succeeded, your time statistic describes 6 people, and the reader must know that. Time data from failures can still be useful for diagnosing problems, but keep it separate from the efficiency metric.
Three ways to summarize
The three summaries below answer slightly different questions.
| Summary | How it is calculated | Effect of one very slow time | Best used for |
|---|---|---|---|
| Arithmetic mean | Sum of times divided by the count | Large | Totals, such as estimating total time across many users |
| Median | Middle value after sorting | Small | Describing a typical participant, especially with fewer than about 25 times |
| Geometric mean | The nth root of the product of times | Moderate | Estimating the center of skewed time data in small samples |
The arithmetic mean
The arithmetic mean is the familiar average. It is the right choice when you need to scale up. For example, if you want to estimate how many hours a team will spend on a task across 500 uses, the mean is what you multiply. For describing the typical participant in a skewed sample, it is usually the weakest of the three.
The median
The median is the middle value when times are sorted. With an even number of times, it is the average of the two middle values. Extreme values barely affect it, so it is easy to explain and hard to distort.
The median has a weakness in small samples. It depends only on the middle one or two values and ignores the rest of the data. With very few participants, the sample median is a noisy estimate of the typical time. It also jumps in steps as you add data.
The geometric mean
The geometric mean works on the logarithm of each time. You take the log of every value, average those logs, and convert back with the exponential function. This is equivalent to multiplying all the times and taking the nth root.
Taking logs compresses the long right tail. A 120-second time becomes only modestly larger than a 50-second time on the log scale. The geometric mean therefore tracks the center of skewed data better than the arithmetic mean, and it uses every observation, unlike the median. Research on usability time data has found it to be a good estimator of the center for small samples, typically between about 2 and 25 participants.
The geometric mean requires every time to be greater than zero, because the log of zero is undefined. Real task times are always positive, but check for data entry errors such as a recorded time of 0.
Comparing the three on real numbers
The following program uses eight successful attempts, one of which is much slower than the rest.
import math
import statistics
def geometric_mean(times):
"""Geometric mean of positive task times (for example, seconds)."""
return math.exp(statistics.fmean(math.log(t) for t in times))
times = [32, 41, 38, 55, 47, 120, 36, 44] # successful attempts only, in seconds
print("arithmetic mean:", round(statistics.fmean(times), 1))
print("median:", statistics.median(times))
print("geometric mean:", round(geometric_mean(times), 1))Running it gives these results:
- Arithmetic mean: 51.6 seconds
- Median: 42.5 seconds
- Geometric mean: about 46.7 seconds
Seven of the eight participants finished in 55 seconds or less. The arithmetic mean of 51.6 is higher than all but one of the eight times, so it does not describe a typical participant. The median and geometric mean sit inside the main cluster.
Notice that the geometric mean is between the other two. It is pulled up by the 120-second time, but less than the arithmetic mean is. That is the intended behavior: it reduces the influence of the tail without discarding the information in it.
Choosing a summary
Use these rules as a starting point.
- Fewer than about 25 successful times: report the geometric mean, and consider reporting the median alongside it.
- About 25 or more successful times: the median becomes a reliable estimate, and you can report it as your main summary.
- You need to project total time or cost: use the arithmetic mean, and say so.
- Comparing two designs: use the same summary for both. Switching methods between conditions makes the comparison meaningless.
State which summary you used in the report. A reader who sees "average time: 47 seconds" cannot tell whether that is a mean, a median, or a geometric mean, and the three can differ by a large amount.
Removing outliers: be careful
Because slow times look suspicious, people are tempted to delete them. Do this only with a documented reason.
A time is a justified exclusion when you know something went wrong with the session itself. Examples are a participant who left the room, a recording that paused, or a technical failure unrelated to the design. Write down the reason for each exclusion.
A time is not a justified exclusion just because it is slow. A participant who took 120 seconds may have hit a real usability problem, and that is exactly what the study should detect. Deleting it hides evidence. When in doubt, keep the time and use a summary, such as the median or geometric mean, that is resistant to its influence.
Reporting uncertainty for time data
A summary with no sense of its precision can mislead, particularly with small samples. For time data, confidence intervals are usually calculated on the log scale, because the log-transformed times are closer to a symmetric, bell-shaped distribution.
The procedure is:
- Take the log of each time.
- Compute the mean and standard error of the logged values.
- Build an interval around the mean using a t critical value that matches your sample size.
- Convert both ends of the interval back with the exponential function.
The back-converted interval is asymmetric around the geometric mean. That is expected and correct for skewed data. An interval of "35 to 62 seconds" around a geometric mean of 47 is more honest than a single number.
The following program implements this. It uses a table of t values for common sample sizes so that it runs with only the standard library.
import math
import statistics
# Two-sided 95% t critical values by degrees of freedom (n - 1)
T_95 = {1: 12.706, 2: 4.303, 3: 3.182, 4: 2.776, 5: 2.571, 6: 2.447,
7: 2.365, 8: 2.306, 9: 2.262, 10: 2.228, 11: 2.201, 12: 2.179,
13: 2.160, 14: 2.145, 15: 2.131, 19: 2.093, 24: 2.064}
def geometric_mean_ci(times):
"""Geometric mean with an approximate 95% confidence interval."""
n = len(times)
df = n - 1
if df not in T_95:
raise ValueError("add a t value for this sample size")
logs = [math.log(t) for t in times]
mean_log = statistics.fmean(logs)
sem = statistics.stdev(logs) / math.sqrt(n)
margin = T_95[df] * sem
return math.exp(mean_log), math.exp(mean_log - margin), math.exp(mean_log + margin)
times = [32, 41, 38, 55, 47, 120, 36, 44]
gm, low, high = geometric_mean_ci(times)
print(f"geometric mean {gm:.1f} s, 95% CI about {low:.0f} to {high:.0f} s")For these eight times, the interval is roughly 36 to 60 seconds around a geometric mean near 47. It is wide, which is normal with eight participants. If you remove the 120-second time to make it look better, you would make the interval narrower and the claim stronger without any real gain in knowledge.
Common mistakes
- Averaging failed and successful attempts together. The result does not measure efficiency. Summarize successful attempts only.
- Reporting "average" without naming the method. Say mean, median, or geometric mean.
- Using the arithmetic mean on a small skewed sample and presenting it as the typical time.
- Dropping slow times without a documented cause.
- Computing a geometric mean with a zero or negative value in the data. Check for entry errors first.
- Comparing designs with different summaries, such as a median for one and a mean for the other.
- Reporting a single number with no interval, which hides how little a small sample can tell you.
Key points
- Task times are right-skewed, so the arithmetic mean overstates the typical time.
- Summarize time from successful attempts only, and report how many there were.
- For small samples, the geometric mean is a strong choice for the center. For larger samples, the median works well.
- Use the arithmetic mean only when you need to project totals.
- Exclude a time only for a documented, design-independent reason.
- Give a confidence interval, calculated on the log scale, so readers see how uncertain the estimate is.
Exercise
A team runs a checkout task with 10 participants. Two fail. The eight successful times are 28, 30, 31, 33, 35, 36, 38, and 95 seconds. A teammate suggests reporting the arithmetic mean of all ten attempts, filling in the two failures with the 180-second time limit, and deleting the 95-second time because it is "obviously an outlier." Name the three problems with this plan and describe what you would do instead.
Show answer
The three problems are: (1) including failed attempts, filled in with the time limit, mixes non-completions into an efficiency measure, so only successful attempts should be summarized; (2) deleting the 95-second time without a cause unrelated to the design throws away possible evidence of a real usability problem; (3) the arithmetic mean is a poor summary for skewed data in a small sample. Instead, summarize the eight successful times with the geometric mean (and optionally the median, which is 34 seconds), keep the 95-second time unless you have a documented non-design cause, report that n = 8 successful attempts, and give a 95% confidence interval calculated on the log scale. Report the completion rate (8 of 10) separately.
Exercise
Why can the geometric mean of a set of task times never be larger than the arithmetic mean of the same set, and what does the gap between them tell you about the data?
Show answer
For positive numbers, the geometric mean is always less than or equal to the arithmetic mean, with equality only when all values are identical. Taking logs compresses large values, so the tail influences the geometric mean less. A large gap means the data are strongly skewed or contain a few very large values. A small gap means the times are tightly clustered and the choice of summary matters little.