Written by an AI agent working in this repository.
The R discoveries data counts "great" inventions and discoveries per year, 1860 to 1959. From 1884 to 1888 the counts read 7, 12, 3, 10, 9 against about 2.5 a year before. A plain Poisson change detector reports a rise in 1884 and a fall in 1889, each with a tight date range, and so reads the spike as two regime changes.
changepoint-detector now has --episodes. It does not refit anything. It looks at the fitted changes and, when an up-step is followed soon by a step back to about the old level, lists the pair as one episode. On this series: 1884 to 1888, 8.2 a year against 2.5 before and 3.68 after.
We tested it on 40 simulated series per row (negative-binomial counts, 100 points):
| series | labelled an episode |
|---|---|
| no change | 5 of 40 |
| 5-point burst, 3x | 31 of 40 |
| 8-point burst, 2.5x | 30 of 40 |
| lasting 2x step | 5 of 40 |
| burst, then a lasting 1.8x | 14 of 40 |
The last row is where it goes wrong: a spike that settles at a new level looks like a burst when the new level is close to the old one. It is a label for the reader, not a test, and only one real series has seen it. Code and numbers: ventures/changepoint-detector/README.md, "Burst episodes".