Skip to content
Start free

Randomized test or before-and-after?

An AI compares four weeks before a redesign with four weeks after. See what a trend already under way does to that comparison.

2 parts · 5 and 3 min

Free course. Your Maestro, an AI, .

Before leaving the checkout experiment from the previous module, recall one question for yourself: what assumptions does that 95% rely on to hold?

In that earlier experiment, an setup assigned each incoming session in the same week by chance to either the current checkout or the redesign. Because both versions ran during the same days and chance decided who saw which version, any gap between the two groups came from the checkout change itself or the random draw of sessions.

Now suppose a second AI skipped the experiment table and read a weekly summary instead. Looking at eight weeks of traffic, it said: "After the redesign launched in week 5, conversion rose from 3.9% to 4.6%."

That claim comes from an observational before-and-after comparison. Nothing assigned weeks to the old checkout or the redesign by chance. Weeks 1 through 4 ran under the old checkout, and weeks 5 through 8 ran later under the redesign. Anything else in the calendar or the business that shifted between those two periods moved right along with the launch. If you want to talk through how calendar time differs from random assignment, ask your Maestro.

Try it

Run the comparison below, then look at the week-to-week changes with weeks["rate"].diff() and project the pre-launch trend across weeks 5 through 8 with np.polyfit. Ask your Maestro if you want a hint on the projection.

Your turn

Run the before-and-after comparison. Add the change from each week to the next, then fit a straight line to the four weeks before launch and project it over weeks 5 to 8. You're done when you can compare the projected after-weeks with what happened.

A good place to stop. Up next: What the weekly numbers show · 3 min

What the weekly numbers show

Compare what your code printed with the weekly data:

  • Before launch (weeks 1 to 4): With 5,000 sessions a week, orders were 180, 190, 200 and 210. Those weekly rates of 3.6%, 3.8%, 4.0% and 4.2% average to 0.039 (3.9%).
  • After launch (weeks 5 to 8): Orders were 220, 225, 235 and 240 out of 5,000 sessions a week, with a mean rate of 0.046 (4.6%).
  • Week-to-week changes: weeks["rate"].diff() prints 0.002, 0.002, 0.002, 0.002, 0.001, 0.002 and 0.001. Conversion was already climbing 0.2 percentage points (0.002) a week before launch, and slowed to 0.001 in two of the after weeks.
  • Projected trend vs. observed after weeks: Extending the straight line from weeks 1 through 4 predicts rates of 0.044, 0.046, 0.048 and 0.05 for weeks 5 through 8. That projected after mean is 0.047 (4.7%), slightly higher than the 0.046 (4.6%) actually observed. If your projected mean differs from 0.047, share your code with your Maestro.

What each design supports

How the groups were formed decides what claim the numbers can support:

  • Randomized comparison: Assigning sessions by chance during the same weeks exposes both groups to the same trend and seasonal swings at once. It supports a causal claim about the redesign's effect on the tested population and period, with chance quantified. Even so, randomization does not guarantee that the same effect holds in every future month.
  • Observational before-and-after: Comparing weeks before launch with weeks after launch describes what happened over time. It cannot separate the redesign from an existing trend, seasonality or other changes in those weeks, so a causal claim requires strong added assumptions that nothing else moved.

Watch for two common traps with before-and-after numbers. A large gap between the before and after averages does not by itself prove the launch caused the rise, because an ongoing trend creates a gap even when the launch changes nothing. Averaging more weeks on each side does not fix a trend problem either: averaging a longer upward slope still leaves the after period higher than the before period.

Check yourself: A team launches a new checkout at the start of week 5 and sees mean weekly conversion rise from 3.9% in weeks 1 to 4 to 4.6% in weeks 5 to 8. Which statement about this comparison holds?