# Does an incentive's effect differ by driver tenure? (declared before any run)

The first page of this study compares ways to test a driver incentive and how to decide on the result, in a simulated
city where the same 64 drivers stay for the whole test. Its part 1 says what that leaves out: "drivers joining or
leaving, so the model cannot test retention questions". This page adds drivers joining and leaving, as a separate
module, and asks two questions of the existing test design, with no new experiment:

1. Read from the existing driver test (half the drivers get the incentive, CUPED on their earlier rides), does the
   incentive's effect differ by how long a driver has been driving, and how often would one test say so when it does
   not?
2. With a fixed incentive budget, does spending it on everyone, on the tenure band the test ranks first, or on the
   drivers a fitted uplift rule ranks first add the most rides in the following month, once some drivers have left and
   new ones have joined?

Every choice below is fixed before any run of this page's code on the declared seed. The machine-readable copy is
[tenure/protocol.json](tenure/protocol.json). Anything decided after the results is labelled on the page as decided
after the results.

## What this page does not repeat

- How driver cohorts by start month stay active is published on real data in
  [Planning revenue from active drivers](/marketplace-revenue-forecast/active-drivers.html) ("How cohorts of drivers
  stay active"). This page shows no retention curve as a finding. Its joining and leaving is an assumption calibrated
  to that page's published shape (below), used only to give the simulated city a realistic mix of new and long-standing
  drivers and a realistic turnover between the test and the month the budget is spent.
- Which drivers are likely to leave (churn risk), and spending by churn risk against spending by uplift, is out of
  scope: no churn model is fitted. Leaving here does not depend on the incentive.
- How to fit an uplift list on a randomized pilot, and how it compares with a propensity list, is shown in
  [Two sales motions, held out](/retargeting-holdout/sales-motions.html). This page uses the simplest uplift rule
  (below) and does not re-derive the method.
- Which test design measures the incentive best, and what sharing riders or a lingering effect do to a driver test, is
  part 1 ([Marketplace experiment designs](/marketplace-experiments/)). This page runs only the case with neither,
  where a driver test is valid, so the subgroup read is not confounded by those failures.

## The simulated city

Part 1's simulator, called unchanged: 16 regions on a 4 by 4 grid, 4 driver seats per region (64 drivers), each
seat with its own catchment of riders, a driver quality draw that sets how many rides the driver can give and how many
requests the catchment sends, region and time shocks, 8 blocks of 3 time slots, the first slot of each block left out
of the outcome. The incentive adds up to one ride of capacity per driver per slot. No sharing of riders between drivers
and no lingering effect (part 1's "no interference" case). The part 1 files used (`sim/model.py`, `sim/inference.py`,
`sim/experiment.py`) are byte-identical copies, checked by hash against part 1's published export.

A second, larger city with 8 by 8 regions (256 drivers) is run the same way, to see how the reads change with four
times the drivers in the test.

## Drivers joining and leaving (the new module, an assumption)

- **Seats.** Each of the city's driver seats is held by one driver at a time. When a driver leaves, a new driver takes
  the seat at the start of the next month, keeping the seat's catchment and quality draw. So the city never runs short
  of drivers; only the mix of tenure changes.
- **Tenure.** Months since the driver's start, where month 1 is the first full month.
- **Leaving.** A driver in month t stays into month t+1 with chance S(t+1)/S(t), where S is the share still active by
  months since start for drivers who started in 2024 on the published page above, read at whole percents for months 1
  to 31: 100, 76, 63, 53, 46, 39, 32, 29, 26, 24, 22, 20, 17, 16, 14, 13, 12, 12, 11, 10, 10, 9, 9, 8, 8, 7, 7, 7, 7, 7,
  6. After month 31 the chance of staying is constant at (6/8) to the power 1/6, about 0.953 a month, the average over
  months 25 to 31. That page counts a driver active with at least one trip in a month; here leaving is permanent. Both
  are simplifications.
- **History.** Every seat starts with a new driver 120 months before the test month and runs month by month, so the
  test month's mix of tenure comes from the joining and leaving, not from a fixed table. The month after the test, the
  same rule runs once more: some drivers leave and new ones take their seats.
- **What the shape implies, before any run (arithmetic on the curve, not a result):** in the long run about 21% of
  drivers are in months 1 to 2, 24% in months 3 to 6, 18% in months 7 to 12 and 37% in month 13 or later, and about
  12% of seats change hands each month.

## How tenure changes the incentive's effect (two settings, assumptions)

- **Flat.** Tenure changes nothing. The test month's city is exactly part 1's city: the same rides, the same
  assignment, the same estimates as part 1's published no-interference run (checked).
- **Ramp.** A new driver is online for less of each slot than they will be later: each seat's capacity in a slot is
  multiplied by m(t) = 1 minus 0.4 times exp(minus (t minus 1) / 3), then rounded down after adding a uniform draw
  shared by both settings. m is 0.60 in month 1, 0.71 in month 2, 0.85 in month 4, 0.92 in month 6 and 0.99 by month
  13. The catchment's requests are unchanged, so a new driver leaves more requests unserved, and the incentive's extra
  capacity is used more often. The incentive itself is the same for every driver.

In the ramp setting, that new drivers gain more from the incentive is **true by construction**: it follows from m(t)
and the capacity rule, not from data. This page's results are about the method: whether one test can see a difference
the simulator puts there, how often it sees one that is not there, and which budget rule turns it into rides.

## The test (the existing design, no new experiment)

Part 1's driver test, unchanged: half the drivers (32 of 64, 128 of 256) get the full incentive for all 24 slots,
chosen by part 1's assignment draw. Outcome per driver: completed rides in the 16 scored slots. CUPED: part 1's
adjustment (fit on the first two of three earlier windows, the third as the covariate, centred at the city mean). In
the ramp setting, the earlier windows use the same tenure and the same capacity rule, so a new driver's history is
also shorter on rides.

**Truth.** With no sharing, each driver's rides depend only on their own incentive, so each driver's true effect is
exact: their rides with the incentive minus without it, in the same draws. A band's true effect in a city is the mean
over its drivers.

## The tenure read (the heterogeneity estimator)

- **Bands**, fixed now: months 1 to 2, 3 to 6, 7 to 12, and 13 or more.
- **Per band:** the CUPED-adjusted rides of the band's drivers, treated mean minus control mean, per driver, with a
  Welch interval at 95% (part 1's `difference` function, divided by the band's driver count).
- **Too small to read:** a band with fewer than 3 drivers in either arm in a city is not read in that city. Its count is
  reported.
- **Do the bands differ?** Cochran's Q over the bands read in that city, weights one over each band's squared standard
  error, against a chi-square with one fewer degree of freedom than bands read; differ when p is below 0.05.
- **Which band differs?** Each band read against all other drivers (the same estimator on the rest), difference over
  the root sum of squared standard errors, Welch-Satterthwaite degrees of freedom, two-sided. Reported unadjusted and
  with Holm's adjustment across the bands read, both at 0.05. In the flat setting, any band flagged is a false
  discovery.
- **Top band:** the band read with the largest estimate. It is right when it is the band with the largest true effect
  in that city among bands with at least one driver.
- **Picking the best band overstates it:** the top band's estimate minus its true effect, averaged over cities.
- **Coverage:** the share of cities in which each band's interval contains that band's true effect in that city.

These four bands give four comparisons against the rest and one joint test per city. A team reading one test sees one
row of them; the 500 cities show how often each reading would mislead.

## The budget (the following month)

- **When.** The month after the test, after one more month of joining and leaving. Rides are counted over one window
  of 24 slots with new draws of requests, capacity and rounding (the continuation of part 1's world draws), and in the
  ramp setting the capacity rule at each driver's new tenure. A driver who joined that month is in band 1 to 2 and has
  no earlier rides.
- **Budget.** A quarter of the city's full incentive: incentive weights summing to 16 drivers (64 in the larger city),
  in every slot. A weight w gives a driver w rides of extra capacity per slot on average (rounded down after adding the
  same uniform draws in every rule). The budget is counted as offered capacity, the same for every rule.
- **Rules:**
  1. **Everyone:** every driver at weight 0.25.
  2. **Tenure band, from the test:** bands ranked by the test's estimate (a band not read gets the test's overall
     estimate), then filled in order at weight 1 until the budget runs out; the last band reached shares what is left
     equally.
  3. **Tenure band, true order (a ceiling for band rules):** the same fill, ranked by each band's true effect in the
     test month. It shows what band targeting gives when the test ranks the bands perfectly.
  4. **Predicted uplift:** a straight-line model fitted on the test's drivers: rides on an intercept, the driver's
     third earlier window (centred), the log of tenure in months, the incentive, and the incentive times each of the
     two. A driver's predicted uplift is the incentive term plus its two interactions. The 16 (or 64) drivers with the
     largest predicted uplift get weight 1. A new driver has no earlier window: they get the mean of the test's drivers
     in months 1 to 2 (zero if there were none). A driver who stayed keeps the window from before the test.
  5. **Each driver's true gain (a ceiling):** the 16 (or 64) drivers with the largest true gain in the month the budget
     is spent, at weight 1. No rule could know this; it bounds what targeting can add.
- **Outcome:** rides in the 24-slot window with the rule minus with no incentive, in the same draws. Each rule against
  everyone: the mean difference over cities with a 95% Monte Carlo interval, and the share of cities where the rule
  added more rides.

## Runs, seed and streams

- 500 simulated cities per city size, seed 7. Part 1's own streams for the world and the assignment (`spawn_key`
  (0, city) and (1, city)), so the 64-driver flat test is part 1's test. New streams for the joining and leaving
  (`spawn_key` (70, city)) and the capacity rule's uniform draws (`spawn_key` (71, city)). Both settings share every
  draw; the rules share every draw.
- A pilot on a reserved seed (90071, 10 cities per size) reads only run time, row counts and the tenure mix, never an
  outcome of the incentive.
- No stopping rule: every city is run, and every result is kept.
- Monte Carlo intervals: shares with Wilson intervals, means with Student intervals over cities. They describe
  uncertainty about this simulator, not about a real city.

## Checks, declared now

- The part 1 files used are byte-identical to part 1's published export (sha256).
- Part 1's published no-interference run is reproduced byte for byte by part 1's own code in this page's
  environment: the full `scenarios.csv` (500 cities, every scenario and design) hashes to part 1's published sha256.
- In the flat setting, this page's world equals part 1's world (requests, capacity, rounding, priority and the earlier
  windows), and the overall CUPED estimate times 64 equals part 1's published driver test estimate for every city.
- This page's world continuation reproduces part 1's world draws exactly before drawing the following month.
- The weight rule at weights 0 and 1 gives exactly part 1's `simulate` result.
- Every rule spends the same budget.

## Predictions, written before any run

Each is reported as held, missed or untestable. Effects are rides per driver over the 16 scored slots; budget rules
are rides added over the 24-slot window.

- **P1 (checks the mechanism; true by construction in direction).** Ramp, 64 drivers: the true effect in months 1 to 2
  minus months 13 or more, averaged over cities, is between 3 and 8 rides. Flat: that difference is within 1 ride of
  zero.
- **P2.** Flat, 64 drivers: Cochran's Q says the bands differ in 3% to 12% of cities.
- **P3.** Flat, 64 drivers: at least one band is flagged against the rest in 10% to 25% of cities unadjusted, and in
  3% to 9% with Holm's adjustment.
- **P4.** Ramp, 64 drivers: Cochran's Q says the bands differ in 10% to 35% of cities.
- **P5.** Ramp, 64 drivers: the test's top band is the true top band in 35% to 65% of cities.
- **P6.** Ramp, 256 drivers: Cochran's Q says the bands differ in 25% to 70% of cities, and the top band is right in
  55% to 90%.
- **P7.** Flat and ramp, 64 drivers: the top band's estimate exceeds its true effect by at least 2 rides on average.
- **P8.** Flat, 64 drivers: each band's interval contains its true effect in 90% to 97% of the cities where it is read.
- **P9.** Ramp, 64 drivers: tenure band from the test adds 5% to 30% more rides than everyone on average, and more
  rides in at least 60% of cities.
- **P10.** Flat, 64 drivers: tenure band from the test is within 5% of everyone on average.
- **P11.** Ramp, 64 drivers: predicted uplift adds fewer rides than tenure band from the test on average.
- **P12.** Ramp, 64 drivers: tenure band in its true order adds at least as many rides as tenure band from the test on
  average.
- **P13 (a check, true by construction).** Each driver's true gain adds at least as many rides as every other rule on
  average, in both settings and sizes.

## Method references

Subgroup effects from a randomized test and why they need a joint test and a multiplicity adjustment:
[Wang, Lagakos, Ware, Hunter and Drazen, NEJM 2007](https://www.nejm.org/doi/full/10.1056/NEJMsr077003). Cochran's Q
for heterogeneity: [Higgins and Thompson, Statistics in Medicine 2002](https://onlinelibrary.wiley.com/doi/10.1002/sim.1186).
Holm's step-down adjustment: [Holm, Scandinavian Journal of Statistics 1979](https://www.jstor.org/stable/4615733).

## Change 1 to the protocol (made before any run of the declared seed)

Written after the code and the pilot (which read only run time, row counts and the tenure mix) and before the first
run on seed 7. It fills cases the text above left open; no outcome had been seen.

- **A band with no drivers in the test month** is scored with the overall true effect in the true-order band rule, as
  a band not read is scored with the overall estimate in the band rule from the test.
- **If the uplift model cannot be fitted** (fewer than six independent columns), that city's predicted-uplift rule
  falls back to everyone at weight 0.25. The number of cities where this happens is reported.
- **Counting:** a city with fewer than two bands read counts as "the bands do not differ" for Cochran's Q and is
  reported as untestable; a city with no band read counts as the top band being wrong.
- **The pilot's tenure mix** (10 cities per size on seed 90071): months 1 to 2, 3 to 6, 7 to 12 and 13 or more held
  21%, 24%, 19% and 36% of drivers with 64 drivers, and 22%, 23%, 18% and 37% with 256, close to the long-run mix
  above. Run time was short enough to run every city in one go; no setting was changed.

## Change 2 to the protocol (made after the run, wording only)

Written after the declared run on seed 7, with every result known. It changes words, not choices. The design text and
the protocol's first key used a working label for this part of the study, which this study's public files do not use,
and the protocol named part 1's export by its folder in the source repository. The text now says "this page", the key
is "page", and part 1's export is named by its published address. No setting, band, estimator, rule, budget, seed,
check or prediction changed. Before this change the design file's sha256 was
f1b35d6054be075c5956905455054c913c5b3d2e762de0821db0cda4cb5e10d2 and the protocol's was
a50d3a5232632c3853edf47729bf925226791f7f81f48737e5b8749300d9d0fd. The results were summarized again from the unchanged
cities.csv (same sha256): every number is the same, and results.json differs only in the renamed key and the protocol's
sha256.

## Post-run code note (read side only)

The commit holding the declared run's results also changed code, after the first run on seed 7. Every `pd.read_csv` in
tenure/run.py and tests/test_reproduce.py now reads with `float_precision="round_trip"` (exact number parsing; pandas'
default parser can miss the last digit of a stored float), and the row-by-row recompute test in tests/test_reproduce.py
compares with `check_exact=True, check_dtype=False`, because a column holding blanks for bands not read is read back
with a different column type. Both are read-side only: no setting, band, estimator, rule, budget, seed, check or
prediction depends on them, and no shown number does. The run was repeated after the change and every verdict was the
same. Read with pandas' default parser instead, the summary differs in 32 of 930 numbers, by at most 4e-15, and in
none at three decimals.
