# Regression discontinuity addendum (added after the results; declared before these runs)

The sixth part's design, protocol, code, runs and results stay exactly as committed. Everything below was decided after those
results had been read, and the page labels it so. This file and `protocol-regression-discontinuity-addendum.json` are committed
before the code that runs them and before any of these runs. Whatever the runs show is reported beside the frozen rows.

## Why

Three gaps showed once the results were read:

1. The page's most worrying figure, a worthless offer read as worth keeping in 79.8% of two-way runs, rests on one setting: a
   20% share, motivation worth 8 trips, 5,000 drivers and a 3-point band. The one-way rows show those inputs move such a rate a
   long way, and the frozen design never moved them for two-way moving.
2. The page recommends running all three checks and deciding from the interval. The frozen design scored "with checks" only for
   the point call, so the rule the page recommends has no score of its own.
3. The plug-in bandwidth's constants were written from memory and never compared with a source, and the bandwidth hardly narrows
   with more drivers, unexplained.

## A. A two-way sweep

The same generator, reads, checks and calls as the frozen `two_way` and `two_way_hidden`, moving one input at a time away from
them. 1,000 runs each. Every setting exists twice: with motivation showing in last quarter's trips, and with it hidden.

| Settings | What moves | Frozen value |
|---|---|---|
| tw_s05, tw_s10, tw_s40 | share moving each way: 5%, 10%, 40% | 20% |
| tw_m04, tw_m12 | motivation worth 4 and 12 trips | 8 |
| tw_few, tw_many | 1,250 and 20,000 drivers | 5,000 |
| tw_b15, tw_b60 | how far a driver can move: a band of 1.5 and 6 points | 3 |

The landing zone stays 1 point and the noise stays 16 trips. These settings draw from the frozen seed entropy and the seed group
of their size, so each is paired with the frozen rows of that size and none is independent of them. Nothing in the generator
changes, so no separate random stream is needed: a test runs the frozen settings through this addendum's path and requires the
stored rows back exactly. A test also pins the frozen results and runs byte for byte.

## B. The recommended rule, scored

On the 19,000 stored frozen rows and on the sweep's rows, with no new draw for the frozen settings. The rule: if any of the three
checks fires, make no call; otherwise keep the offer when the whole 90% interval is above the break-even, drop it when the whole
interval is below, and otherwise make no call. For each setting and planted effect this reports the share of runs settled rightly
with no check firing, settled wrongly with no check firing, and given no call. The local setting is scored at its planted 6.

## C. The plug-in rule's constants and its flat bandwidth

- **Constants.** `cutoff/reads.py` is compared with two working-paper versions of the Imbens and Kalyanaraman paper, the `rdd` R
  package's `IKbandwidth` and the IK branch of `rdbwselect_2014` in the rdrobust R package. Read so far: 1.84, 3.56 and 3.4375 match
  all of them. The term that regularizes the curvature does not: the frozen code has 2160, both working-paper versions and `rdd`
  print 720, and `rdbwselect_2014` computes 3 times 180 on the squared coefficient of the quadratic, which is 2160 on the second
  derivative's scale. The journal version could not be read. The frozen code stays as it is.
- **What the difference does.** On all 1,000 runs of `base`, `curved` and `two_way`, the primary read and its interval are
  recomputed at the frozen rule with 720 in place of 2160, and at the bandwidth rdrobust's current rule picks (`mserd`), beside the
  frozen rows. The checks are not recomputed.
- **Why it is flat.** On runs 0 to 99 of `few`, `base` and `many`, the rule's parts are stored: the third derivative, the second
  bandwidth, the curvature gap and the regularizing term. The explanation to test: with no curvature gap at the line, what the rule
  reads as curvature is noise, and that noise shrinks in proportion to the drivers, which offsets the rule's own shrinking factor.

## Predictions and pass bars

Predictions are scored mechanically, and a miss is reported beside the result and changes nothing. They come from the planning
arithmetic, as the frozen design's did: numerical integration over the generator with no random draw and no simulated outcome.
The bars for B and for the frozen-row comparisons in C were written after the frozen interval counts had been read, so they are
less of a test than the sweep's. Percentages are shares of 1,000 runs at a planted effect of 0 unless stated.

**The sweep, point call wrong**

- A1. Share: at most 20% at 5%, 15% to 40% at 10%, at least 97% at 40%, and rising with the share through the frozen 79.8%.
- A2. Motivation: at most 25% at 4 trips, at least 92% at 12.
- A3. Drivers: 50% to 72% at 1,250, 85% to 99% at 20,000.
- A4. Band: 35% to 60% at 1.5 points, 55% to 80% at 6.

**The sweep, density test**

- A5. Motivation does not touch the scores, so at 4 and at 12 trips it fires in exactly the frozen 89 runs. At most 15% at a 5% and
  a 10% share, at a 1.5-point band and at 1,250 drivers.
- A6. 10% to 50% at a 40% share and at 20,000 drivers, and 15% to 70% at a 6-point band: the flows match less exactly, or the test
  sees more drivers.

**The sweep, balance check**

- A7. Motivation showing: at most 20% at a 5% share, 10% to 40% at 10%, at least 90% at 40%, at most 30% at 4 trips, at least 85% at
  12, 15% to 35% at 1,250 drivers, at least 95% at 20,000, 40% to 65% at a 1.5-point band, 40% to 70% at 6.
- A8. Motivation hidden: at 4 and at 12 trips it fires in exactly the frozen `two_way_hidden` runs, since last quarter's trips and the
  scores are then the same. At most 15% at a 5% and a 10% share, at a 1.5-point band and at 1,250 drivers; 15% to 40% at a 40% share;
  20% to 50% at 20,000 drivers; 40% to 70% at a 6-point band.

**The sweep, the interval**

- A9. Settled wrongly: at most 2% at a 5% share, at most 8% at 10%, at least 65% at 40%, at most 3% at 4 trips, at least 55% at 12,
  5% to 18% at 1,250 drivers, 40% to 65% at 20,000, 8% to 22% at a 1.5-point band, 4% to 16% at 6.

**The recommended rule**

- B1. Clean line: settled wrongly with no check firing in at most 1%.
- B2. `two_way`: 2% to 10%. `two_way_hidden`: 10% to 20%.
- B3. `two_way_hidden`: settled wrongly with no check firing in more runs than settled rightly.
- B4. Clean line at a planted 6: settled rightly with no check firing in 30% to 40%.

**The bandwidth**

- C1. With 720 the bandwidth is wider than the frozen rule's in every run and by no more than 3 to the power 1/5, about 1.25 times.
- C2. Wrong at planted 0 stays within 3 points of the frozen rate on `base` and within 8 points on `two_way`, under both variants.
- C3. The average error on `curved` stays within 1 trip under both variants.
- C4. From 1,250 to 20,000 drivers, the median of the curvature gap squared plus the regularizing term falls by 8 to 32 times (16 if
  it shrinks in proportion to the drivers), and the median second bandwidth changes by less than 30%.

**Pass bars, which stop the round if they fail**

- The frozen settings run through this addendum's path return the stored rows exactly.
- The frozen protocol, design, results and runs hash to their pinned values.
- Every sweep run is stored, with errors counted and left out as in the frozen design. Nothing is re-run unless declared first.

## What ran before this commit

Planning arithmetic for the sweep, with no random draw. A timing of the package's bandwidth rule on the smoke seed (entropy 999),
printing only the time. No sweep run, no score of the recommended rule and no bandwidth variant has been computed.

## Limits

- Still a self-test: one author wrote the generator, the reads, the checks and this sweep, and the sweep moves one input at a time.
- The bars in A come from arithmetic on the same generator, so they guard the code more than they test the design.
- The landing zone, the noise, the shape of the baseline and the way motivation sets who moves stay fixed.
