Sub topic 7
Set duration and sample size
A pilot that is too short or too small gives you a result you cannot trust. A pilot that is too long delays the benefit and ties up the people running it. This chapter shows how to choose a run length and a number of observations before the pilot starts, so that the later "go, adjust, or stop" decision rests on enough evidence.
This chapter assumes you can compute a mean and a standard deviation, and that you have a baseline for the metric you are changing. It also assumes you have already written the hypothesis and success criterion. Both are needed here, because they tell you how large an effect you must be able to detect.
Two questions, two answers
Duration and sample size are related but not the same.
- Sample size is the number of observations you need: orders, tickets, patients, parts. It determines whether you can tell a real change from noise.
- Duration is the calendar time the pilot runs. It determines whether those observations represent normal operating conditions.
Compute both, then take the longer of the two. A pilot site that processes 200 orders a day can reach a sample of 50 in an hour. That does not make a one-hour pilot valid, because the process also behaves differently on Monday mornings, at month end, and on night shifts.
What drives sample size
Four inputs determine how many observations you need per group.
| Input | Meaning | Effect on sample size |
|---|---|---|
| Variation (standard deviation) | How much the metric varies from one unit to the next, taken from the baseline | More variation needs more data |
| Minimum effect to detect | The smallest improvement that matters, taken from the success criterion | A smaller effect needs much more data |
| Significance level (alpha) | The accepted chance of calling noise an improvement, usually 0.05 | A stricter level needs more data |
| Power | The chance of detecting the effect if it is real, usually 0.80 | Higher power needs more data |
The effect size matters most. Sample size grows with the inverse square of the effect, so halving the effect you want to detect roughly quadruples the data you need.
For a continuous metric such as cycle time, with two equal groups, a standard approximation is:
n per group = 2 × ((zalpha/2 + zpower) × sigma / delta)²
Here sigma is the standard deviation from your baseline and delta is the smallest difference worth detecting. Do not take delta from what you hope the change will do. Take it from the smallest improvement that would justify the cost of rolling out.
Worked example in Python
Suppose the baseline cycle time has a standard deviation of 3.5 minutes. The success criterion requires a reduction of at least 3 minutes. The pilot site handles about 12 units a day. The code computes the sample size and a run length.
import math
from statistics import NormalDist
def sample_size_per_group(sigma, delta, alpha=0.05, power=0.80):
"""Units needed in each group to detect a mean difference of delta."""
z = NormalDist()
z_alpha = z.inv_cdf(1 - alpha / 2) # two-sided test
z_power = z.inv_cdf(power)
n = 2 * ((z_alpha + z_power) * sigma / delta) ** 2
return math.ceil(n)
def pilot_days(n_needed, units_per_day, cycle_days=7, warmup_days=3, min_cycles=2):
"""Calendar days: warm-up plus the longer of volume need and full cycles."""
days_for_volume = math.ceil(n_needed / units_per_day)
days_for_cycles = cycle_days * min_cycles
return warmup_days + max(days_for_volume, days_for_cycles)
sigma = 3.5 # minutes, from the baseline
for delta in (3.0, 1.5):
n = sample_size_per_group(sigma, delta)
days = pilot_days(n, units_per_day=12)
print(f"Detect {delta} min: {n} units per group, run {days} days")The output is:
Detect 3.0 min: 22 units per group, run 17 days
Detect 1.5 min: 86 units per group, run 17 daysHalving the detectable effect raised the requirement from 22 to 86 units. Volume alone would need only 2 to 8 days at 12 units a day. The run length stays at 17 days because the calendar rule, not the volume rule, is the binding constraint here.
Proportions need far more data
If your success metric is a rate, such as a defect rate, the variance depends on the rate itself. A common approximation is:
n per group = (zalpha/2 + zpower)² × (p1(1 − p1) + p2(1 − p2)) / (p1 − p2)²
To detect a drop in defect rate from 3% to 2% at alpha 0.05 and power 0.80, you need about 3,800 units per group. This is why defect and guardrail metrics often decide how long a pilot must run. Rare events accumulate slowly.
What drives duration
After you have the volume requirement, check the following conditions. The duration is the largest value any of them gives.
- Warm-up. People are slower on a new method at first. Observations from the learning period describe training, not the steady-state process. Exclude them from the main analysis, or plan to compare the early and late parts of the pilot separately.
- Full cycles. Cover at least two repeats of the natural rhythm of the work: weekly patterns, shift rotations, billing cycles, or month-end peaks. If demand differs sharply by weekday, a pilot that skips a weekend is biased.
- Novelty and fatigue. Performance often rises at first because people are paying attention, then fades. A pilot long enough to see the effect level out gives a more honest result.
- Slow outcomes. Some outcomes appear late: returns, rework, customer complaints, warranty claims. The pilot must run long enough for the outcome to show up, or you must add a follow-up period after the last unit enters.
- Cost of waiting. A longer pilot costs money and delays benefit. If the old process is harmful, a shorter pilot with a stricter guardrail may be justified.
Units, not days
Count the independent units your analysis treats as observations. A common error is to count every measurement as independent when they are not.
- Ten measurements from the same operator on the same day are correlated. They tell you more about that operator than about the process.
- Daily averages from a single site over 20 days give 20 observations, not the thousands of units behind them.
- If you pilot in three teams, the sample for questions about team-to-team differences is three, however many orders each team handles.
When observations are clustered, inflate the sample size or analyze at the level of the cluster, such as team-day. If you are unsure, use the smaller count of independent units and plan conservatively.
Fix the plan before you start
Write the following into the pilot plan before the first data point is collected:
- The metric, the minimum effect, alpha, and power used for sizing.
- The sigma used, and where it came from.
- The planned number of units and the planned end date.
- The rule for excluding warm-up data.
- The conditions for stopping early, which are guardrail breaches, not "the results look good".
Peeking is the practice of checking results repeatedly and stopping the moment they look significant. It raises the false-positive rate well above your nominal alpha, because random fluctuations will at some point cross any threshold. Look at the data as often as monitoring requires, but make the decision at the planned end. If you must allow early stopping for success, agree on a formal rule in advance, such as a stricter threshold at each interim look.
When the numbers do not fit
Sometimes the required sample is larger than the pilot site can deliver. You have four honest options.
- Accept a larger minimum effect. Say openly that the pilot can only detect big improvements.
- Reduce variation. Use a more homogeneous scope, or measure paired units, such as the same task before and after.
- Extend the duration. Weigh the cost against the value of a firm answer.
- Add a site. This increases volume and tests whether the result generalizes, but it adds coordination effort.
Do not quietly lower power or raise alpha to make the plan fit. That hides the risk instead of removing it. If you proceed with a pilot that is too small to give a firm answer, label it a feasibility trial and set the expectation that it cannot, on its own, justify a full rollout.
Common errors
- Sizing the pilot for the effect you hope for rather than the smallest effect worth acting on.
- Using total measurements as the sample size when observations are clustered by operator, day, or site.
- Ending the pilot because the target was reached after a few days, before warm-up effects and cycles were covered.
- Ignoring the delay in outcomes such as rework or returns.
- Changing the end date after seeing the data.
Exercise
Your baseline cycle time has a standard deviation of 6 minutes. The success criterion is a reduction of at least 2 minutes. Without running code, explain whether the required sample size per group is larger or smaller than for a standard deviation of 3 minutes with the same target, and by roughly how much. Then say what else, besides sample size, you would check before fixing the pilot length when the site handles 40 units a day and the work follows a weekly pattern.
Show answer
The sample size is larger. Sample size grows with the square of sigma, so doubling sigma from 3 to 6 minutes multiplies the required units per group by about four. At 40 units a day the volume requirement may be met within days, so duration is set by other conditions. Check that the pilot covers at least two full weekly cycles, add warm-up days that are excluded from the main analysis, and check whether any outcome, such as rework, appears later than the cycle time measurement and needs a follow-up period.