FDE Times dataFDE jobs open 922▼2 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 64Companies hiring 201Remote-friendly 23%Median US pay $202kTop hirer Databricks 113
中文VI

The newspaper of the Forward Deployed Engineer

Guides

How to prove a feature worked when everyone got it at once

Interrupted time series can separate a rollout's effect from the trend already under way, provided you fix the model first and then try to break the result.

ShareLinkedInFacebookX

In brief

  • A before/after comparison of averages can easily credit the rollout with improvement that belongs to the existing trend.
  • Fix the shape of the effect and the change date in advance, gather at least 24 data points, then check residuals and lags.
  • Placebos and a control series help expose false results; with short series, confidence intervals are prone to being too narrow.
Line chart of handling minutes per ticket over 52 simulated weeks: a steady decline from 60 minutes, a drop to 48.0 minutes when the assistant is switched on in week 40, and 45.8 minutes by week 51, while the old trend extends to 49.8 minutes. The gap stays at 4 minutes. The 9.2-minute difference between before and after averages, less 5.2 minutes due to the old trend, leaves 4 minutes attributable to the assistant.
Comparing averages before and after the cut-off shows a 9.2-minute reduction, but 5.2 minutes would have come anyway under the old trend; the assistant contributed only 4 minutes. Source: simulated data in the article (Step 2, zero noise).

At least 24 data points: that is the floor a simulation study published in 2021 recommends for an interrupted time series (ITS) design. If the client stores its metric only by week, you need almost half a year of figures. A deployment team that thinks about measurement only after launch day may already be short of history.

ITS is worth an FDE’s time because the situation it addresses is so familiar: a feature is switched on for everyone and nobody keeps a holdout group. The design builds a trend from the data before the change, then compares what happened with a scenario in which there was no intervention and the trend simply continued.

But a handsome regression line is easy to trust too much. The exercise below sets up a measurement whose answer you already know, then looks for one way after another to make it fail. You need Python, the ability to read a table of regression coefficients and roughly an afternoon.

Step 1: Write the hypothesis before seeing the results

Take a hypothetical example: an assistant that drafts replies for a customer support team, switched on for all of the team’s staff in week 40 (counting from 0). The metric is average handling time per ticket, in minutes, with 40 weeks before the change and 12 after.

The control series has to come from outside: another team’s queue, running on a ticketing system that has not integrated the assistant. The two teams do different work, so this queue serves only to detect shared movements around the change date.

Before running any code, write down the shape of the effect you expect: a level shift, a change in slope or both, and whether there is a lag. Trying five models and keeping the prettiest is the fastest way to fool yourself.

Metric:      average handling minutes per ticket, by week
Change:      week 40, switched on for all support staff
Shape:       level shift, no lag
Control:     another team's queue, system without the assistant
Recording:   did the definition of ticket start and end change?

Do not underrate the last line. If the launch also changed when the ticket clock starts, the model may report a drop that has nothing to do with productivity.

Check: the client’s owner of the metric has read and agreed to these five lines. If they cannot yet answer the recording line, stop here.

Step 2: Make the model recover a known answer

Install three libraries:

pip install numpy statsmodels matplotlib

Then generate simulated data. The metric starts at 60 minutes, was already falling by 0.2 minutes a week, and the assistant cuts it by exactly 4 minutes more. Each week’s noise carries over half of the previous week’s; that is autocorrelation.

import numpy as np
import matplotlib.pyplot as plt
from statsmodels.regression.linear_model import OLS

rng = np.random.default_rng(7)
N, T0 = 52, 40
t = np.arange(N)
step = (t >= T0).astype(float)

def noise(sigma):
    e = np.zeros(N)
    for i in range(1, N):
        e[i] = 0.5 * e[i - 1] + rng.normal(0, sigma)
    return e

sigma = 0.0   # first run: noise off
y = 60 - 0.2 * t - 4 * step + noise(sigma)
control = 45 - 0.2 * t + noise(sigma)

def fit_its(series, effect):
    n = len(series)
    X = np.column_stack([np.ones(n), np.arange(n), effect])
    return OLS(series, X).fit()

naive = y[T0:].mean() - y[:T0].mean()
res = fit_its(y, step)
print("before/after:", naive)
print("ITS:", res.params[2])

Check: with zero noise, the first line must give -9.2 and the second -4, ignoring floating-point error. Now plot the actual series alongside the old trend extended past week 40; close the plot window to let the code continue.

old_trend = res.params[0] + res.params[1] * t

plt.plot(t, y, label="actual")
plt.plot(t, old_trend, "--", label="old trend extended")
plt.axvline(T0, color="gray", linestyle=":")
plt.xlabel("week")
plt.ylabel("minutes per ticket")
plt.legend()
plt.show()

Check: the two lines coincide through week 39, at 52.2 minutes. From week 40 they part: the old trend is at 52.0 minutes, the actual series at 48.0. By week 51 they stand at 49.8 and 45.8 minutes, still exactly 4 minutes apart.

The average is 56.1 minutes before the change and 46.9 after, so the before/after comparison reports a drop of 9.2 minutes. But the midpoints of the two periods are 26 weeks apart, and the metric was already falling by 0.2 minutes every week. So 5.2 of the 9.2 minutes would have come without the assistant, which contributed only 4.

Now set sigma = 1.0 and rerun from the top; the coefficient will move away from -4. To see how much deviation is normal, repeat the simulation 2,000 times directly below the code above:

fits = []
for _ in range(2000):
    fits.append(fit_its(60 - 0.2 * t - 4 * step + noise(1.0), step))

est = np.array([f.params[2] for f in fits])
se = np.array([f.bse[2] for f in fits])
print("mean estimate:", est.mean())
print("true standard deviation:", est.std())
print("standard error reported by OLS:", se.mean())

Check: the three results should be close to -4, 0.87 and 0.5; differences of a few percent come from the simulation. About 95% of individual runs give a coefficient between -5.7 and -2.3. The last number is more worrying: OLS ignores autocorrelation, so it reports only a little over half of the true variation.

What if the rollout takes several weeks?

When the feature is switched on gradually, replace the step column with a ramp that then levels off. Here is a simplified version for a four-week rollout, assuming the effect grows evenly:

ramp = np.clip((t - T0 + 1) / 4, 0, 1)
# weeks 40, 41, 42, 43 -> 0.25, 0.5, 0.75, 1
# Use only if the plan in Step 1 specifies a four-week rollout:
# res = fit_its(y, ramp)

Check: use the client’s actual activation schedule and ignore the date in the announcement email. The simulated data above jumps instantly, so this exercise continues with step.

Step 3: Inspect the residuals before reading the errors

Keep sigma = 1.0. With sigma = 0, the residuals are only machine rounding error, so the results in this step would tell you nothing.

Do not leave the autocorrelation check to a single Durbin-Watson number: the simulation study advises relying on that test only with long series. Take the residuals, call them r, and plot them by week first:

r = np.asarray(res.resid)

plt.plot(t, r, marker="o")
plt.axhline(0, color="gray")
plt.xlabel("week")
plt.ylabel("residual (minutes)")
plt.show()

Check: look for runs of several consecutive weeks on the same side of the zero line; they are a sign of autocorrelation. If the residuals bend into a wave, consider seasonality or a nonlinear trend before you consider success.

Next, look at the partial autocorrelation at the first four lags. The code below computes it by regression, a simplified approach, then recalculates the standard errors:

def partial_ac(r, k):
    n = len(r)
    lags = [r[k - j:n - j] for j in range(1, k + 1)]
    X = np.column_stack([np.ones(n - k)] + lags)
    return OLS(r[k:], X).fit().params[k]

for k in range(1, 5):
    print(k, partial_ac(r, k))

robust = res.get_robustcov_results("HAC", maxlags=4)
print("coefficient:", robust.params[2])
print("standard error:", robust.bse[2])
print("confidence interval:", robust.conf_int()[2])

HAC is used here to compute standard errors that take autocorrelation into account. In statsmodels you have to choose the number of lags, maxlags, yourself, and the data must be one consecutive, evenly spaced series. So sort by week and deal with missing weeks first. The value of 4 is only for practice: try a few others and record whether the conclusion changes.

Check: adding HAC leaves the coefficient unchanged; only the standard error moves. Set it beside the 0.87 from Step 2 to see how far short it still falls.

Nor is HAC a complete answer. With short series, every method in the simulation study underestimated autocorrelation, making standard errors too small and leaving confidence intervals with coverage below 95%. Another evaluation, published in 2023, recommends Prais-Winsten over ARMA and Newey-West, so a formal report should also compare against that method.

Step 4: Pretend the rollout happened on days when nothing did

A placebo in time refits the model at fake change dates before the intervention. The “effects” it produces there form a background distribution. The CausalPy documentation sets a clear threshold: a real effect counts as evidence only when it lies well outside that background; a credible interval that excludes 0 is necessary but not sufficient.

The shortened version below applies the idea to this exercise’s model, taking 12 weeks after each fake date and never touching week 40 or later:

fake = []
for d in range(12, 29):
    sub = y[:d + 12]
    post = (np.arange(len(sub)) >= d).astype(float)
    fake.append(fit_its(sub, post).params[2])

fake = np.array(fake)
real = res.params[2]
print("number of fake dates:", len(fake))
print("at least as strong as the real one:", (abs(fake) >= abs(real)).sum())

Check: there must be 17 fake dates, and the shortest window must be exactly 24 weeks long. If many fake dates show effects as large as the real one, you have nothing to report yet. The windows overlap and are shorter than the full series, so treat the ratio as a guide and do not call it a p-value.

Step 5: What else happened that week?

Placebos cannot answer this question. A single series cannot rule out accompanying interventions or simultaneous events, particularly those that change faster than the underlying trend. A 2018 study of controls in ITS proposes adding a control series, so that you compare both before with after and places that had the intervention with places that did not.

print("control:", fit_its(control, step).params[2])

Check: with sigma = 0, the result must be 0, ignoring floating-point error; with sigma = 1.0, it varies around 0, usually within ±1.7. On real data, if the control queue also drops clearly in week 40, look for a common cause: a new policy, ticket volume, a round of hiring.

A control series is valid only if the intervention does not reach it. Google’s CausalImpact states this assumption and warns that, if it is violated, the effect may be under- or overestimated. If hard tickets are moved to the control queue after the assistant goes live, the comparison is no longer usable.

What to say in the meeting room

At a client, a measurement exercise usually ends in one question: “So how much does it save?” Fill in the template below with the results you ran, and bring the comparison of averages too, so the client can see which part is the old trend.

The ITS coefficient and naive are negative here, while the wording already says “fell”, so drop the minus sign and swap the two bounds. For example, a printed interval of -5 to -3 becomes “3 to 5 minutes”. If the coefficient is positive or the confidence interval contains 0, do not use this template to claim a reduction.

After the assistant was switched on, handling time fell by about
[absolute value of the ITS coefficient] minutes per ticket against
the old trend, with a HAC confidence interval from [upper bound,
minus sign dropped] to [lower bound, minus sign dropped] minutes;
the true uncertainty may be wider still. The before/after
comparison of averages gives a drop of [absolute value of naive]
minutes because it includes the decline already under way. Of
[number of fake dates] fake dates, [k] showed an effect at least
as large as the real one; the control queue changed by [c, sign
kept] minutes. The measurement has not ruled out another change
that affected only the support team in the same week.

The range of -5.7 to -2.3 from Step 2 does not belong in this template: it comes from 2,000 simulations, which you will not have at a client.

Catch three errors yourself before entering the room: moving the change date to one that gives a better result, altering the shape of the effect after seeing the chart, and failing to check whether the way the metric is recorded has changed. With any of them, the code still runs and raises no warning.

When reading FDE job postings, look out for phrases such as “measure impact”, “prove value” or “define success metrics”. Prepare to describe a time you measured an effect, tried to refute your own result and knew where it remained weak. On your résumé, state the metric, the number of data points, the checks you ran and the limitations that remain.

The hardest work comes before launch day: requesting the metric’s history, finding a queue the rollout does not touch, locking down definitions. Once the feature is on, no line of Python can recreate the weeks you never recorded.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
9 sources
Read next on the roadmap · Stage 6: MeasurementThe teams waiting for AI training are your best control groupLimited training capacity forces rollouts into waves anyway; order the waves deliberately and the queue measures the tool's real impact at almost no extra cost.