> ## Documentation Index
> Fetch the complete documentation index at: https://oxy.tech/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Past data and few-unit designs

> Analysing a design whose dates have passed, designing for a handful of markets, and comparing a few chosen units with a synthetic control

## Analyse past data

Sometimes the question is about something that already happened: *did last
spring's flash sale work?* The data exists, but nobody registered a plan
before it ran. Oxygen can still analyse it, under a label that makes its
standing clear.

### When it is offered

Write the design as you would for a new experiment, with the dates on which
the change actually happened, and price it. Its registration deadline has
passed, so the page shows **Registration refused** with the reason. Once all
of the design's dates are in the past, the same page offers **Analyse past
data** (workspace owners and admins), with this explanation:

> All of this design's dates are in the past. The result will be labelled
> "not pre-registered": it is exploratory, not a registered test, and no
> levers are switched.

It is refused while any day of the last after window is still to come.

### A rollout that was not randomised

When the change was rolled out to units someone chose (a feature switched on for
some listings, a policy applied to some stores), say so: under **Lever**, choose
**Already changed**. The form then asks for no automations. Under **Assignment**,
add one wave for each date the change went live, with the units it reached; every
other unit becomes the comparison. No seed is needed and pricing is optional. When
pricing cannot size the design (too little history), the report says **MDE
unavailable** with pricing's reason instead of refusing to read the data.

The report's **Randomisation** check then reads **Observational**: the treated and
comparison units were not drawn at random, so they may differ in ways other than
the change. If you edit a priced design's waves by hand, the same check reads
**Written by hand**.

### What happened after it ended

A promotion can look like it worked while it only moved purchases earlier:
shoppers stock up during the deal and buy less afterwards. To read the days
after a past change ended, give its wave **Ended on**, the first day it was off
(`switch_off` on the wave), and set **Keep reading after it turns off** to the
number of days to read. The report then reads those days against the same
before window and says whether the effect
[lingered, was not measurable, or reversed as pull-forward](https://oxy.tech/docs/guide/build/world-model/experiments/report.md#after-the-lever-turned-off).

It needs one change date, and the after window must not overlap the one
measured during the change: **Ended on** can't fall before the after-switch
window ends, so set that window to run up to the end date (a deal from 11 to
24 May reads 14 days after its switch and ends on 25 May). **Analyse past data**
is offered once the last of those days is over. **Ended on** is offered only
under **Already changed**: a registered run's lever turns off when it closes. Use the date the
change really ended. A promotion stopped early but recorded with its planned
end date reads the wrong days.

### A few changed units on one date

With one change date, the result is tested with **Welch's t-test** by default.
It is right for groups split evenly, however small, but it learns how much the
changed units vary from those units alone: with two or three of them it can
hardly ever call a result clear. When a handful of units changed beside many
that did not, set **Test for one change date** to **Permutation**
(`design.one_date_test: permutation`). The changed units are then read against
every unchanged one, by asking how often a random pick of that many units moved
as much. It allows for the changed units being busier or quieter than the rest.
It needs enough units for a random pick to be rare (three against three is not),
and the analysis takes seconds rather than an instant. Several change dates are
always tested this way.

### Units with missing data

When reading past data, a unit with too little data (fewer than the design's coverage
floor of the days, 90% by default) is left out, and a listed unit with no data at all is
left out of its group. Neither stops the analysis or removes days for the other units.
The report lists each one under **Dropped units, waves or pairs**, with the reason.

A unit that is missing only a few days keeps the days it has: its before and after
averages use those days, and no other unit loses anything. If it holds less than the
coverage floor of one comparison's before or after window, it is left out of that
comparison only, and named, for example: *"left out of the comparison switching on
2026-05-14: holds 14 of the 20 days in its after window, under the 90% coverage
floor"*. A product out of stock for a week therefore no longer removes that week for
every product, which used to drop whole waves.

### A share as the outcome

To measure a share per unit (for example merchant-fulfilled units out of all units
sold), set **Divided by** under **Outcome**. Each unit's share is its total of the
outcome measure over its total of this one in each window, so a busy day counts for
more than a quiet one. Shares are analysed from past data only for now, and the report
gives no total for them.

### A percentage lift instead of a change in units

When the units differ a lot in size (a product that sells 100 a day beside ones
that sell 2), a change in units is dominated by the big ones: their ordinary swings
from day to day are larger than the whole lift on a small product. Under
**Outcome**, set **Read the change as** to **% lift per unit**. Each unit's daily
value `y` is read as `ln(1 + y)`, so a product going from 2 to 3 a day and one
going from 100 to 150 both move by the same amount, and the report gives the result
as a percentage: *"+18.4% per unit-day (+3.1% to +36.0%)"*. The interval is not
symmetric around the percentage, so both ends are shown.

Read it as the typical unit's lift, with every unit counting alike; it is not the
total change in units, so the report gives no total for it. It is approximate when
values sit close to zero, where the `+ 1` dominates. A day with a negative value
(refunds larger than sales) cannot be read this way, and the analysis is refused,
naming the unit and day. Like a share, it is analysed from past data only for now,
and it cannot be combined with **Divided by**, a driver, or a switchback.

### When the analysis is refused

If the analysis is refused (for example, a unit listed in a wave has no data), fix
the design or the data and choose **Analyse past data** again. A refused analysis
leaves no result, so the design stays editable; an analysis that produced a result
is final.

### What is different from a registered run

| | Registered run | Analyse past data |
| - | - | - |
| Levers | Switched on and off on schedule | **Never touched**; no automation runs |
| Confirming switches | Checked in the data | Not measured, since Oxygen made no switches |
| Guardrails | Watched hourly | None |
| Control group | Fixed shortly after registration | Fixed from the design's own before window: units with data then, never units that appeared later |
| Report label | **Registered result** | **RETROSPECTIVE — not pre-registered** |
| Slope proposed to the semantic model | When the guards pass | **Never** |

The run is created directly in the closing state, the design is locked like
any other, and the estimate runs as soon as possible. An experiment has one
run, so a design analysed from past data cannot also be registered; duplicate
it to run it for real.

### Why it is labelled the way it is

Writing the plan before the data exists is what entitles a registered
experiment to a plain significance test. A design written after the fact had
no such protection. Its author may, without meaning to, have chosen the
windows, the units or the measure that made the past look best. So the
report always leads with *"RETROSPECTIVE — not pre-registered: the design
was written after its data existed, so this is an exploratory reading, not a
registered test"*. And a slope found after the fact is a candidate to test,
not a coefficient to write into the model.

> [!TIP]
>
> Use past-data runs to decide **what to test next**. If a retrospective read
> looks promising, duplicate the experiment, move the dates forward and run
> it registered.

## Designing for a few units

Geographic tests often have only a couple of dozen markets, and a chain may
have only a handful of stores it controls. With few units, the luck of the
draw matters a lot: one random split can put the three biggest markets on
the same side, and those three then decide the result. Four tools help.

### Matched pairs

**Match in pairs** sorts the units by their recent average, pairs neighbours
in that ranking, and flips a coin within each pair. Every pair puts one unit
on each side, so a lopsided draw is impossible. With 24 markets you get 12
pairs, 12 treated and 12 controls; an odd unit out becomes a control. It
needs at least four units.

### Staggered waves with a few held back

When some units must get the change and others cannot (for example,
company-owned stores against franchises), staggering the owned stores over
two or three waves, with any others held back, keeps a control on every date.
It usually prices close to a single wave of the same size.

### Groups

If single units are too noisy, randomise whole groups. This only helps when
there are still enough groups: the sample becomes the number of groups.

### Switchback

If no unit can be held back at all, the whole fleet can alternate. It needs
at least six pairs of periods at a significance level of 0.05, or four at a
directional 0.2.

## Synthetic control

A promotion usually runs on a few products someone chose, and a campaign in
one or two markets. Nothing was randomised, so the units left out are not a
fair control: they were not picked to resemble the ones that changed, and an
average over all of them can move very differently from three best-sellers.

**Synthetic control** builds the missing comparison for each changed unit
from the units that did not change. For a promoted product, it finds a
weighted blend of unpromoted products (say 40% product B, 35% product F, 25%
product K) whose sales tracked the promoted product's sales closely over the
before window. After the promotion starts, that blend shows what the product
would probably have sold without it. The effect is the gap between the two,
averaged over the changed units.

### Setting it up

It reads past data. On a design whose units were **Already changed** (under
**Lever**), set **Compare the changed units with** to **A synthetic control**.
Then list under **Keep out of the comparison** any unchanged unit the change
may still have reached: a sibling product that customers switch to, or a
neighbouring store that sees the same ads. Use one wave: every changed unit
switched on the same date. It needs at least 10 unchanged units to blend.

### Reading the report

The report is labelled **Not randomised — synthetic control** and states two
assumptions every time: the change did not reach the units in the blend, and
nothing else changed for the changed units alone after the switch date. A
section **Each changed unit against its synthetic control** lists, for each
unit:

* **Effect**: its own gap after the change.
* **Tracked before**: how closely the blend followed it before the change,
  as *Close*, *Fair* or *Loose*. A blend that did no better than a flat line
  at the unit's average is refused rather than shown: its "effect" would be
  the fit's error.
* **Stands out**: the same fit is repeated pretending each unchanged unit had
  been changed. *top 5%* means only 5% of those pretend gaps were as large as
  this unit's.
* **Built from**: the units in its blend and their weights.

Click a unit to chart it against its blend, before and after the change. The
headline's p-value comes from the same pretend fits, over all the changed
units together. No projection onto other units is offered: the blend was
chosen to follow the changed units, not to represent the rest.

> [!NOTE]
>
> Synthetic control is for past data only for now. Pricing a future synthetic
> design, so it can be registered before it starts, is not built.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.