An interrupted time-series study needs a fixed intervention date, repeated outcomes on a stable measurement scale, and explicit treatment of preparation and transition periods.
Interrupted-series outcome clock and data contract
Start with the operational event
A service organization introduces a routing rule across its entire queue in September. The announcement happened in July, staff training began in August, and the rule took effect on September 1. Those are three distinct dates. If staff alter behavior during training, August is not an untouched baseline month. Freeze the event ledger before looking for a favorable break. The branch rollout clock handles a related timing problem when adoption differs by branch.
Specify the outcome at each time point
Use a monthly deadline-breach rate: eligible tickets breaching the deadline divided by all eligible tickets closed during that month. Retain both numerator and denominator, the inclusion rule, time zone, close-date convention and any ticket migration. A jump in the rate may follow a denominator change rather than the routing rule. Monthly counts also vary; a month with forty tickets carries different measurement uncertainty from one with four thousand.
Demand enough history to interrogate the model
A line through two pre-policy points always fits, but tells little about seasonality or a changing slope. Inspect several complete cycles if the operation has an annual pattern. Record missing months rather than silently connecting adjacent observations. The code checks a complete monthly grid, unique month keys, positive denominators and numerator bounds. It does not claim that a given number of observations guarantees a credible effect.
Separate the analytic windows
Mark clearly untreated months, possible anticipation months, transition months and stable post-policy months. Do not relabel the last pre-month after seeing a sharp dip or rise. If the rule rolled out over several weeks, a simple September step may misstate exposure. Transition sensitivity makes that uncertainty explicit. The resulting series is the input to segmented estimation.
State the missing counterfactual
The pre-policy trend is used to predict what would have happened after September without the rule. That extrapolation can fail if demand, staffing, holidays, product mix or the recording system changed at the same time. The time-series structure gives more information than a simple before/after average, but it does not itself isolate the policy. A suitable unaffected comparison series can improve the design, as described in the controlled-series lesson.
Implementation
def audit_monthly_outcomes(monthly_rows, first_month, last_month):
expected = set(range(first_month, last_month + 1))
seen = set()
rates = {}
for month, breaches, eligible in monthly_rows:
if month in seen or month not in expected:
raise ValueError("duplicate or out-of-window month")
if eligible <= 0 or breaches < 0 or breaches > eligible:
raise ValueError("invalid rate components")
seen.add(month)
rates[month] = breaches / eligible
if seen != expected:
raise ValueError("missing months: " + str(sorted(expected - seen)))
return [rates[month] for month in sorted(expected)]
queue_rows = [(month, 17 + month, 100 + 2 * month)
for month in range(1, 15)]
breach_rates = audit_monthly_outcomes(queue_rows, 1, 14)
assert len(breach_rates) == 14
assert abs(breach_rates[0] - 18 / 102) < 1e-12Performance and operating cost
For T months, dictionary-backed validation is O(T) expected time and O(T) space. A complete data contract also needs historical definition and intervention logs, which cannot be inferred from the numeric rate alone.
Common Mistakes
- Do not choose the intervention month after viewing the outcome break.
- Do not treat training and launch dates as interchangeable.
- Do not calculate rates without preserving their numerators and denominators.
