# A retention test when group-mates pull each other along (declared before any run)

The group forecast part simulates an app where a user's chance of staying active rises with the share of their
group-mates who were active last month. Its page reasons that a retention test which randomizes users would then
measure less than a full launch gives, and says it did not run that test. This part runs it, on the same simulated
apps, and compares it with a test that randomizes whole groups. Test design itself (user, group and graph-cluster
tests, and an exposure model) is covered by the shared-groups part, for a one-off spillover on a test outcome; this part
does not repeat that comparison. What is new here is where the spillover comes from: the coupling in monthly activity,
which compounds month after month. Every choice below is fixed before any run of the test code on the declared seed,
and the machine-readable copy is [data/retention-test-protocol.json](data/retention-test-protocol.json). Every earlier
run and its files are unchanged; their hashes are listed in the protocol and checked before and after the run.

## The simulated apps

The group forecast part's simulator, with its settings unchanged. Every number is an assumption I chose, not an
estimate from any company's data: 14,000 possible users in groups of 2 to 8, 15% of users in a second group, groups
arriving at a growing rate, and monthly activity on the log-odds scale with a base of -2.2, plus 3.6 if active last
month, a user effect (SD 1.0), a first-group effect (SD 0.5), a month shock shared by every user, and the coupling:
coupling times (the share of the user's joined group-mates who were active last month, minus one half). Three settings:
0 (no coupling), 1 (moderate, the base) and 2 (strong).

Months 1 to 36 replay that part's random draws exactly, so each history before the test is the history that part
forecast. The run checks this: the nobody-treated world's monthly active users, months 1 to 48, must equal that part's
published month counts for every setting and history.

## The test

- **Who is in it.** The users active in month 36 (the test users). Nobody else is ever treated.
- **The change.** From month 37, a treated user's log-odds of being active each month rise by a fixed lift: 0.3 (the
  primary lift) or 0.15. The lift is an assumption, not a measured effect.
- **The outcome.** Active in the test's last month, among the test users. Three test lengths: 3, 6 and 12 months; 6 is
  the primary length.
- **User test.** Half of the test users (rounded down) treated at random. Difference in the share active between arms,
  with a Welch interval.
- **Group test, the same size.** The same test users; each takes their first group's assignment, and half (rounded
  down) of the first groups holding a test user are treated at random. A user in two groups follows their first.
  Difference in the share active between arms, with an interval clustered by first group.
- **The full effect.** Every test user treated against no test user treated, in the same history with the same draws.
  This is what a launch to all of them would give, and the target both tests are scored against.
- **Shared draws.** Within a history, the four worlds (nobody treated, everyone treated, the user test and the group
  test) share every activity draw, so they differ only by who is treated. Both tests' assignments come from one
  random stream per history.
- **Runs.** 200 histories per setting, seed 23 (the group forecast part's seed, so the same apps), two lifts and three
  lengths: 3,600 rows.

## What is measured

For each setting, lift, length and test: the share of the full effect measured (mean estimate over mean full effect),
the bias in percentage points, both with a bootstrap 95% Monte Carlo interval over histories (2,000 resamples, seed
2929); the spread of the error over histories, with the group test's over the user test's; how often each 95% interval
contains the history's full effect; and how often it lies above zero.

Why a test misses, in three pieces that add up by construction: the treated arm's shortfall (treated users fall short
of their own months with everyone treated, because some of their group-mates are untreated), the control arm's lift
(control users gain from treated group-mates they would not have had with nobody treated), and chance imbalance (the
remainder: which users the coin put in each arm). With no coupling the first two are exactly zero by construction.

One worked example, declared now: history 0 of the moderate setting at the primary lift and length, arm by arm. It is
not chosen to show a pattern.

## Predictions, written before the run

Each prediction is scored held or missed on its point value after the run; a prediction holds only if every part
holds. Primary lift and length unless stated.

1. With no coupling, the user test and the group test each measure 95% to 105% of the full effect. This is a safe bet:
   with no coupling no user's activity depends on another's, so both tests are unbiased by construction, and only Monte
   Carlo noise could fail it.
2. At moderate coupling, the user test measures 70% to 95% of the full effect.
3. At strong coupling, the user test measures less than at moderate coupling, and less than 85% of the full effect.
4. The group test measures at least 92% of the full effect in every coupling setting.
5. At moderate coupling, the group test's spread is 1.0 to 1.5 times the user test's.
6. At moderate coupling, the user test measures a smaller share of the full effect at 12 months than at 3 months.

## Checks

- Census: 3,600 rows, every value finite.
- Sizes: the user test treats exactly half (rounded down) of the test users; the group test treats at least one.
- Replay: 28,800 monthly counts of the nobody-treated world equal the group forecast part's published counts. A wrong
  replay of the simulator fails it; the tests show a changed coupling failing it.
- With no coupling, each test's mean gap from the full effect is within 4 Monte Carlo standard errors plus 0.1 point, at
  every lift and length. A test that leaked treatment between users with no coupling would fail it.
- The tests also run the mechanics on a reduced population with a reserved seed: the replay, the assignments, zero lift
  giving identical worlds, and no leak without coupling (with a positive control that shows the leak once coupling is
  on). They read no effect size. No pilot was run.
- A failed check is reported and kept; nothing is rerun with other random draws.

## What this leaves out

The coupling and the lift are built into the simulation, and I wrote both the simulation and the tests, so this is a
self-test of test designs against a process I chose, not evidence about any real app. The lift is the same for every
treated user and every month; a change that worked through invitations or shared features would spread differently.
Groups are fixed, nobody leaves a group, and 15% of users sit in a second group, which is the only way a group test
leaks. Graph-cluster tests and exposure models are not rerun here; the shared-groups part compares them.
