# City launches without an A/B test

When a change goes live in a whole city at once, compare the city with matched cities that did not launch. In a
simulation I built so that matched cities work (the launch city sits at the centre of the other cities), a synthetic
control read a planted +6% lift as +5.9% on average, where a naive before and after read +36% in the base case and
-13% to +45% as the season's strength and the launch date change. When an event hit the launch city or the launch
pulled trips from its neighbours, the synthetic control read about +10% and would have scaled the losing incentive in
144 and 150 of 200 launches.

## What it is

A study of five ways to estimate the effect of a change that cannot be randomized: a driver incentive for a whole
city, the same pay for every driver, or an app feature switched on for everyone. The data is a synthetic panel of 20
ride-hailing cities over 156 weeks, synthetic so that no customer data is shared. One city launches at week 130 and
gains exactly 6% in every week after, so each method can be scored against the truth.

Methods: naive before and after, comparison-city growth, difference-in-differences, a forecast of the city's own
history, and a synthetic control (with and without the neighbouring cities). Situations: no season (a control), a
season turning up at launch, a one-off event in the launch city, spillover into neighbours, only three comparison
cities, and a launch city on a faster trend. Each situation runs 200 fresh launches. Intervals come from placebo runs
on the cities that did not launch.

The design, the pass bar and 13 predictions were written and sealed before any result (`DESIGN.md`, hash in
`DESIGN.sha256`); 8 of 13 held. The page `index.html` reports the results and the misses.

## Who it is for

Data and product leaders who have to say whether a city-wide change worked, and analysts choosing a method.

## Run it

    python3 -m pip install -r requirements.txt
    make all          # run, after-run counts, tests, page

`make run` rewrites `results.json` and `runs.csv` from the seed. `make capture` needs `requirements-capture.txt` and a local Chrome.

## Declared sensitivity sweep

`sweep-protocol.json`, written before the sweep ran, reruns the base case's 200 launches with the launch city's season
at 0, 10, 15 and 20% (every city's season scaled with it) and with the season shifted by 0, 13, 26 and 39 weeks, for
the naive read, difference-in-differences and the synthetic control. It also scores every launch in `runs.csv` from
its 90% interval against the break-even (pays, does not pay, cannot tell) and counts point-estimate wrong calls at
break-evens of 7 to 12%. `python3 -m study.sweep` writes `results-sensitivity.json`.

## Files

- `DESIGN.md`: the sealed design and predictions.
- `study/sim.py`: the synthetic cities. `study/methods.py`: the estimators and intervals. `study/run.py`: the run
  and the scoring. `study/after_run.py`: descriptive counts added after the run (wrong calls at break-even, share
  within 2 points); they are not pass bars.
- `results.json`: every summary figure. `runs.csv`: every launch, method, estimate and interval. `after-run.json`.
- `assumptions.json`: declared cost assumptions for the rollout section.
- `site/render.py`, `site/page.css`: build the page from the results. `tests/`: the checks.

## What is real and what is synthetic

The cities, trips, effects and events are synthetic. The methods, the scoring and the recommendation are the work this
study shows. Costs and values on the page are declared assumptions, labelled where they appear.

Some files are packed in city-launch-without-ab-test-data-1.zip and its sibling parts; unzip them here to restore the full export, which the manifest lists file by file.
