Finding changepoints when the date is unknown
Today let's work out exactly when a series changed, without anyone telling us the date first.
Line 4 of a juice-bottling plant fills 500 ml bottles, and its target fill weight is 500 ml. Every production day, one bottle is sampled and weighed. Here are 150 days of those readings.
Somewhere past the two-thirds mark of the chart, the line visibly settles lower than where it started. Nobody flagged a change on any particular day. There was no maintenance log entry, no alert, nothing to say "this is where it happened".
That is the problem this lesson solves: finding the day a series changed, when the only evidence is the series itself.
What a changepoint is, and the two kinds of change behind it
A changepoint is the last observation of a segment before a series' statistics move to a new, constant value. A segment is just a stretch of the series where those statistics, its mean or its spread, stay constant. Before the changepoint you have one segment; after it, a new one begins.
A segment's statistics can differ from the next segment's in two distinct ways. Its mean can shift, so the series settles at a new average level. Or its variance can shift, so the series keeps the same average but gets noisier or quieter around it. A real change can involve either one, or both at once.
Since this data was simulated, we actually know where the true change sits: day 95. In practice you never get told that. But seeing it once, with the real numbers on each side, is what makes every method in this lesson easy to judge afterwards.
Days 1 to 95 average 500.14 ml with a standard deviation of 2.65. Days 96 to 150 average 494.34 ml with a standard deviation of 3.02. The mean dropped by almost 6 ml. The spread barely moved, so whatever happened here, it looks like a change in mean, not in variance.
From here on, pretend you do not know day 95. Every method in this lesson has to find it on its own.