# Shared groups (declared before any run)

The main study covers spillover between drivers and regions in a simulated ride-hailing city. This part covers a
different shape of interference: groups of users who share an app, such as families, friend groups or small teams,
where one member's treatment reaches the others. Every choice below is fixed before any run of the new code, and the
machine-readable copy is [data/groups-protocol.json](data/groups-protocol.json). The main, sensitivity, decision
and memory sweep runs and their files are not touched; their hashes are listed in the protocol and checked by the
tests.

## The question

When one member's treatment reaches the rest of their group, how far off is a user-level A/B test from the effect of
giving the change to everyone? Do group-level randomization or graph-cluster randomization fix the miss, and at what
cost in precision? Can an exposure model, which counts each user's treated group-mates, estimate the spillover
itself?

## The simulated users

Every number here is an assumption I chose, not an estimate from any company's data.

- **Users and groups.** 50,000 users per population. Each user has one first group of 2 to 8 people, with sizes
  drawn with weights 22%, 20%, 18%, 15%, 11%, 8% and 6% (about 4.2 people on average). Groups sit on a ring in the
  order they were drawn, which stands in for social nearness.
- **Overlap.** A declared share of users, 0%, 15% or 30%, also joins one second group, drawn from the 20 groups
  nearest their own on the ring. Overlap is what links groups into a wider graph.
- **Outcome.** Weekly active days averaged over the test: a base of 3.0, plus a group effect shared by the members of
  a user's first group (SD 0.8), plus user noise (SD 1.5). It is kept continuous, with no floor at 0 or ceiling at 7.
- **Treatment.** A direct effect of 0.08 days for a treated user, plus a spillover that grows with the share of the
  user's group-mates who are treated, across all the groups the user is in. Spillover at full strength (every mate
  treated) is 0, 0.04, 0.08 or 0.16 days: none, half, equal to and twice the direct effect. Two shapes: linear in the
  share, and a threshold that switches the whole spillover on once at least half the mates are treated (tested at 15%
  overlap only). A no-effect setting at each overlap checks false wins.
- **Target.** The global effect: everyone treated against no one treated, which equals the direct effect plus the full
  spillover in every setting.
- **Runs.** 18 settings, 500 populations each, seed 17. Within one overlap level the same 500 populations and the same
  assignments are reused across spillover strengths and shapes, so the comparison between settings is not noise.

## Designs compared on the same populations

1. **User A/B.** Half the users treated at random; difference in means with a Welch interval.
2. **Group-level randomization.** Half the first groups treated; every member takes their group's assignment, and a
   user in two groups follows their first. Difference in means with an interval clustered by group.
3. **Graph-cluster randomization.** Groups are first clustered by a declared partition, then half the clusters treated.
   The partition is a greedy capped merge: each user in two groups links them; links are taken heaviest first, and
   two clusters merge if the result holds at most 60 users. It uses only the links, so a team could run it on its own
   group graph; links of equal weight, which are most of them, are taken in group-number order, which is ring order.
4. **Exposure model on the user A/B.** The same user A/B data, analysed by regressing the outcome on the user's own
   treatment and the share of their group-mates treated. The two coefficients summed estimate the global effect; the
   share coefficient alone estimates the spillover. Interval clustered by first group.

For each design and setting: bias against the global effect, the spread of estimates, interval coverage, power (or
the false-win rate with no effect), and the study's ship, stop or keep-testing rule applied unchanged to the
estimate, in extra active days per 1,000 users per week with a bar of 100 (0.1 day per user). The rule's two
ride-log checks have no counterpart in a user graph, so only its estimate layer applies. The base setting for the
headline is 15% overlap with spillover equal to the direct effect, linear.

## Predictions, written before the run

Each part is scored true or false after the run; a prediction holds only if every part holds.

1. **User A/B**, base setting: it measures 45% to 55% of the global effect; its interval covers the global effect in
   under 10% of populations; the rule ships in under 5%.
2. **Group-level**, base setting: it measures 80% to 95% of the global effect; its spread is 1.2 to 1.6 times the
   user A/B's; the rule ships in 40% to 80%.
3. **Graph-cluster**: at the base setting its gap is at most two thirds of the group design's gap and its spread is
   0.95 to 1.25 times the group design's; at 30% overlap (spillover 0.08) it still measures at least 90%.
4. **Exposure model**: within 5% of the global effect and coverage of at least 90% in every linear setting with an
   effect; spread 1.5 to 3 times the user A/B's at the base setting; under the threshold shape (spillover 0.08) it
   misses the global effect by more than 10%, in either direction.

## Checks

- Census: 36,000 result rows, every estimate finite.
- Bookkeeping: the global effect computed by treating everyone and no one equals the declared value in every
  population. It confirms the code path and cannot fail on a wrong model.
- With no effect, each design's false-win rate stays within the main run's tolerance (about 10.9%).
- With no spillover, each design's mean gap stays within 4 Monte Carlo standard errors plus 0.001 days.
- A failed check is reported and kept; nothing is rerun with other random draws.

## What this leaves out

Groups here are fixed for the test, so nobody joins or leaves a group because of the change. Spillover only adds,
never takes away. The outcome has no floor or ceiling. The overlap is local by construction (second groups are near
the first on the ring); if second groups were spread at random across the whole graph, no partition could keep them
together, and the graph-cluster result would not carry over.

## Wording changed after the run

After the run, the file names and wording of this part were changed: the users' groups and the partition's units
(clusters) are named in neutral words, two degrees-of-freedom formulas in the protocol are written out in words, and the
partition's tie-break is described as it runs. No setting, seed, code logic or result changed.
