Bayesian Online Changepoint Detection
Paper · 2007 · Ryan Prescott Adams and David Mackay
Summary
When a data stream changes abruptly, observations that were useful a moment ago may become poor guides to what happens next. A sensor can start reporting from a changed environment, or a financial series can become more volatile while its average stays approximately the same. Bayesian Online Changepoint Detection asks how to recognize this kind of change as the observations arrive. The paper treats the time since the latest change as an unknown quantity. Its algorithm updates the probability of each possible elapsed time and uses those probabilities to forecast the next observation.
The method works by keeping several possible histories in play. Each history says that the current stretch of observations began at a different point in the past. When a new value arrives, the algorithm checks how well each history predicted it. It then allocates probability between continuing the stretch and ending it, using a prior that specifies how likely stretches are to end at different ages. Ending a stretch resets its length to zero and starts the next forecast with fresh information about the unknown parameters. Continuing a stretch retains what its observations have taught the algorithm. The paper derives an exact update under its assumptions and shows how to implement it with compact summaries of the observations for a useful class of probability distributions.
To demonstrate the same procedure, the authors draw on well measurements, the Dow Jones Industrial Average’s daily returns, and records of disasters in coal mines. The examples differ in what can change. The well data are analyzed for shifts in the average measurement, the returns for changes in volatility, and the disaster counts for changes in the event rate. In the well example, shorter inferred runs accompany visible shifts in the measurements, and predictive uncertainty increases around apparent transitions. The market and mining examples show how the inferred run lengths can be read alongside a volatility forecast or a cumulative event count. These are demonstrations through plots. The paper supplies no comparative accuracy scores or test of whether the historical events annotated in the plots caused changes.
Deep dive: Bayesian Online Changepoint Detection
Bayesian Online Changepoint Detection estimates when a data stream last changed and uses that uncertainty to predict its next observation. · about 38 minutes to read
The problem and its context
When older observations become less useful
A sequence can look stable over a short interval and behave differently once that interval ends. In the well example, readings from a stretch of drilling are informative about the usual level for that stretch. After the drill reaches material with a different response, a longer average can combine readings from distinct levels. The averaging procedure may estimate its own quantity precisely while answering the wrong question for the next reading. The paper addresses the problem of deciding how much of the past to carry forward when the point at which its relevance changed is uncertain.
The authors call a boundary between successive stretches a changepoint. At such a boundary, there is an abrupt change in the parameters governing how the observations are generated. A parameter is an aspect of the probability distribution, such as its mean or variance. The distinction between an observation and a parameter matters here. An individual value can be unusually high because there is ordinary variation within a stretch. A change in the mean says that high or low observations will occur with different probabilities from then on, even if successive values overlap across the boundary. A similar distinction holds between a large daily return and a change in the variability of daily returns.
The procedure handles these possibilities by asking what the recent observations are jointly compatible with. A long, stable stretch supports using an estimate based on many values. A new pattern can make an estimate based on a shorter stretch more plausible. Estimating from a shorter stretch also means having less data about its parameters. There is a cost to discarding relevant history as well as a cost to retaining irrelevant history. The method represents uncertainty about the boundary so that the forecast can account for both.
The authors motivate the problem in part with systems that must act while their surroundings change. A robot may have accumulated sensor readings while a door was open or furniture was in a particular position. Once the environment changes, its current decision still has to be made with the information available at that moment. A change in lighting creates a related problem for a vision system. An abrupt shift in brightness can alter the conditions under which recent measurements were informative. Both examples connect change detection to a decision about what to expect next.
The difference between finding a boundary and making a forecast
In retrospective segmentation, the complete sequence is available when the analyst decides where to divide it. Evidence on either side of a candidate boundary can inform that decision. An apparent change near the middle of the record may look different after the analyst sees how long the new pattern lasts. The result can include a collection of proposed boundaries or a distribution over several ways to partition the full record.
Online inference has a different information constraint. At each point the algorithm receives one observation and can use everything through that point. Its forecast concerns a value it has yet to see. The qualification “causal” in the paper’s description of predictive filtering refers to this order of information. It expresses the requirement that future observations be unavailable at forecast time. The same constraint applies when the algorithm is run through a historical record to demonstrate what it would have inferred as each value arrived.
The paper concentrates on the latest boundary because this is the boundary that decides which observations inform the current parameters. Given a candidate latest changepoint, the relevant observations are the contiguous stretch after it. The number of observations in that stretch is the run length. Expressing the unknown boundary in terms of elapsed observations makes the update particularly simple. As the stream advances, an ongoing run becomes longer by one observation, while a boundary puts the state back at the start of a run.
A probability distribution over run lengths can convey a result that a single estimated date would hide. Evidence may support a long continuation and a recent change at the same time. In that case the method preserves both possibilities, including the forecasts they imply. An analyst interested in a retrospective chronology would ask what the entire record says about each past boundary. The paper’s filter instead asks how to represent such uncertainty at the current time and how to use it in the next prediction.
What earlier changepoint work addressed
In the authors’ account, frequentist research had already produced procedures for detecting changes online. They describe a line of work from Page and Lorden to a detector using support vector machines. This establishes that sequential detection was an existing problem with existing approaches. The paper’s contribution concerns how to do Bayesian inference for the age of the current run and carry its uncertainty into a sequential prediction.
The authors characterize much of the Bayesian work they cite as retrospective. That literature often seeks a segmentation of the whole sequence or a way to sample candidate changepoint locations from their posterior distribution. A posterior is a probability distribution after evidence has been taken into account. Sampling from a posterior over all the boundaries answers questions about how the complete series might be divided. The authors also acknowledge earlier exceptions to the retrospective emphasis, including work on locating a discontinuity recursively. Their description leaves room for both antecedents and a different formulation of the problem.
The paper uses the idea of a product partition. The sequence is divided into contiguous, nonoverlapping stretches. Within each stretch, observations share a parameter setting and are independent given that setting. The setting for a new stretch is drawn independently from the same parameter prior. These assumptions determine which parts of the past matter for a particular forecast. Once the latest boundary and the observations since it are given, earlier stretches have no additional observations to offer about the current parameters.
That last condition gives the paper a way to avoid carrying every possible segmentation forward. Two histories can place their earlier boundaries in different locations and still agree on where the current run began. Their predictions for the current run then depend on the same data. The algorithm can combine their probability in a single run-length state. The connection between the partition assumption and this compression is what makes the sequential calculation possible.
The method, step by step
Following several possible ages of the current run
Think of the algorithm just before a new reading arrives. For each possible run length, it has a probability that this is the age of the current stretch. It also has a way to predict the reading if that age is correct. A long-run possibility uses the observations from a longer stretch. A short-run possibility starts from a more recent boundary and has fewer observations to work with. The empty-run possibility has only the prior information about a fresh stretch.
The reading has a different evidential value for each possibility. If a long stretch has established a fairly steady level and the new reading lies far from it, the long-run prediction may assign it little density. A shorter stretch can assign it more density if the several readings associated with that stretch are already consistent with the new value. Density plays the role of predictive support for a continuous reading. For a discrete observation, such as a weekly count, the corresponding quantity is a probability.
The algorithm takes the weight of each possible previous run and multiplies it by that predictive support. The resulting weight is split between extending the run and ending it. The split uses the prior chance of an ending at the run’s current age. Extending a particular run leads to its own new length. Ending any run leads to the same new length, zero, so all those contributions can be added. The algorithm then normalizes the weights into a distribution, updates the summaries used for prediction, and issues a new forecast.
The order also fixes a convention about the boundary. In the recurrence, the arriving observation is scored under the previous run. The new state says whether the run continued through that observation or ended there. When the new length is zero, the current run is empty for the purpose of forecasting the following observation. When the length grows, the new observation contributes to that run’s forecast. Keeping the scoring and the reset in this order makes it possible to identify which observations each state actually uses.
Updating run lengths and forecasting the next observation
The steps in order.
What a run-length state represents
The paper writes the arriving observation as xₜ, with t indicating its position in the sequence. A range of subscripts such as 1:t includes both endpoints. The expression x₁:ₜ therefore denotes all observations received through position t. The run-length variable rₜ describes the age of the current run after that update. Where the authors specify the run’s own observations, a superscript in parentheses distinguishes the corresponding contiguous subset from the entire record. The subset can be empty.
There are two layers of uncertainty. Even if the current run length were known, the observations in that run would generally leave some uncertainty about its parameters. Separate from that, the algorithm is unsure how many observations belong to the current run. In the well example, the first question is what mean is plausible for a given recent stretch. The second asks how recently that stretch began. Estimates made under different answers to the second question will usually differ in both their center and their spread.
The assumptions allow the second layer to be summarized by the run length. Observations in any given stretch are assumed to be independent and identically distributed conditional on its parameters. Independence in this conditional sense allows evidence from individual observations to accumulate within the stretch. The same parameters govern its observations, so the sequence is treated as having a stable distribution until a change. Parameters for different stretches are themselves independent draws from a common prior. A boundary thus removes the need to use the previous stretch’s observations to estimate the new parameters.
A particular state stands for more than one history whenever different earlier partitions could have led to it. Those histories can be summed because the data used for its prediction are the same. The recurrence also compresses the histories that end at the latest step. They can have differing prior ages and preceding observations, but they all lead to an empty run whose next forecast uses the fresh parameter prior. This is the reason their weights can be pooled.
How the prior sets the chance that a run ends
The paper specifies a prior probability distribution over the length of a completed stretch. It can be expressed as a hazard, which is the probability that a run ends at a particular length conditional on reaching that length. The conditioning is important. A prior probability for a completed length refers to all runs, including those that would already have ended sooner. The hazard restricts attention to runs still eligible to end at the stated length.
H(τ) = P_gap(g = τ) / Σ_{k = τ}^∞ P_gap(g = k)
Here H is the hazard function and τ is the candidate length at which the run could end. The random variable g is the full gap between changepoints, and P_gap is its prior probability distribution. The index k enumerates eligible gap lengths. The sum Σ includes lengths from τ upward with no finite upper limit, indicated by ∞. The denominator is the total prior probability that the gap reaches at least τ.
A hazard can in principle depend on the age of the run. For example, a gap distribution that assigns no probability to short completed runs also rules out endings at those ages. The authors use a geometric gap prior in their experiments. Its hazard is constant, an expression of the memoryless property. The chance of ending at the next opportunity has the same prior value at each age.
H(τ) = 1 / λ
Here λ is the timescale of the geometric gap prior and τ is the age argument of H. The reciprocal of λ gives the probability of ending at an eligible step. A larger λ allocates less prior probability to an immediate reset and more to continued runs. The same prior can apply at all times without forcing the posterior probability of longer or shorter runs to stay constant, since the observations change the relative support for those histories.
For the general age-dependent case, the previous state has length s. The next event tests whether the gap ends at length s plus one. The paper’s transition equation uses that age for both the reset hazard and its complement.
P(rₜ = j | rₜ₋₁ = s) =
H(s + 1) if j = 0
1 − H(s + 1) if j = s + 1
0 otherwise
Here P denotes probability and the vertical bar indicates conditioning. The variable rₜ is the new run length, rₜ₋₁ is the preceding one, and j and s are their respective candidate values. An ending yields j equal to zero. Continued growth yields j equal to s plus one. The term H(s + 1) is the hazard at the gap length tested by the transition, and 1 − H(s + 1) is the probability of surviving that test.
The displayed algorithm uses the preceding length as the hazard argument, while the transition equation uses that length plus one. This indexing difference has no effect on the reported examples because their hazards are constant. For an age-dependent hazard, the transition equation and the definition in terms of the completed gap give the convention used here.
Passing probability into the next state
Let the working weight for each state be the joint probability, or joint density in the continuous case, of that state and the observations through the present update. A previous weight contains the evidence accumulated up to that point. In the next update, it is multiplied by the conditional predictive probability or density of the arriving value. It is then multiplied by the transition probability to the new state.
Jₜ(j) = Σ_s P(rₜ = j | rₜ₋₁ = s) πₜ(s) Jₜ₋₁(s)
Here Jₜ(j) denotes the joint weight of state j and observations x₁:ₜ. The quantity Jₜ₋₁(s) is the corresponding joint weight at the preceding update for state s and observations x₁:ₜ₋₁. The sum Σ_s ranges over the possible previous lengths. The transition factor is the conditional probability given in the previous block. The term πₜ(s) is the predictive probability or density that state s assigned to the value xₜ before that value was observed.
πₜ(s) = P(xₜ | rₜ₋₁ = s, xₜ₋₁⁽ˢ⁾)
Here xₜ is the incoming observation and xₜ₋₁⁽ˢ⁾ is the observed stretch associated with the candidate previous length s. The notation rₜ₋₁ = s sets the length being considered. The conditional P is the probability or density based on that run’s parameter information. Its value is evaluated at the observation just received. It is conditional on the previous run because the transition first scores the observation in that run and then decides how much weight to send to each destination.
For a growth state, the sum over previous states reduces to a single contribution. A candidate run of a given positive length can grow only from the run that was one observation shorter. The reset state receives a contribution from every previous length. The same previous state can therefore contribute to both destinations, with separate factors determined by the hazard. The paper illustrates these movements with a diagram in which continuing runs trace a rising path through successive updates and reset paths all return to the row for length zero.
Once the joint weights are available, the sum across the new lengths gives the evidence for the observations. The evidence is the weight of the observed data after accounting for every candidate current state. Dividing by it turns the relative weights into posterior probabilities.
P(x₁:ₜ) = Σ_j Jₜ(j)
Here P(x₁:ₜ) is the evidence for the prefix ending at t, x₁:ₜ denotes that prefix, and Jₜ(j) is the joint weight of the prefix and current length j. The sum Σ_j runs over all current lengths. For continuous observations the evidence is a density evaluated at the observed prefix.
P(rₜ = j | x₁:ₜ) = Jₜ(j) / P(x₁:ₜ)
Here the left side is the posterior probability that the current length rₜ equals j given all observations x₁:ₜ. The numerator Jₜ(j) is the unnormalized joint weight for that possibility, and the denominator P(x₁:ₜ) is the sum of the joint weights. The division makes the probabilities of the mutually exclusive possible lengths add to one.
There is a useful consequence of the timing convention when the hazard is constant. Every previous state sends the same fraction of its observation-weighted mass to the reset state. The sum of those weighted masses before the split is the evidence used to normalize the new states. The posterior at length zero therefore equals the constant hazard at each update. The evidence for a recent change is visible in how the probability is distributed over short positive lengths as observations accumulate. A plot can show a high-probability trajectory returning close to the bottom even though the probability assigned to the zero row itself stays fixed. This consequence helps interpret the figures and clarifies why the full run-length distribution matters.
Starting at a known boundary or inside an ongoing run
The update needs a starting distribution over run lengths. The authors give a simple case in which observation begins just after a known boundary. They use a game as an example of a process with an identifiable start. The initial run has length zero with certainty and its parameters are described by their prior. Subsequent lengths and parameter information then come from the observations and the transition rule.
P(r₀ = 0) = 1
Here r₀ is the run length at initialization, before the first observation in the sequence. The expression P(r₀ = 0) is the probability that this initial run is empty, and 1 gives it all the initial probability mass.
The paper also considers observation beginning partway through an ongoing process. It gives climate as an example of an application where a recent record could be only a portion of the process of interest. The first observed value gives no principled reason on its own to put a boundary at the left edge of that record. In this case the authors derive the initial probabilities from the survival function of the gap prior. The survival function gives the probability that a run lasts beyond a stated age.
S(τ) = Σ_{k = τ + 1}^∞ P_gap(g = k)
Here S is the survival function, τ is the proposed initial age, and k indexes possible completed gap lengths. The probability P_gap(g = k) is the prior mass on a gap g of length k. The sum begins at τ plus one and includes all longer gaps, so its value is the probability of a completed length strictly greater than τ.
P(r₀ = τ) = S(τ) / Z
Here r₀ is the initial run length, τ is one of its possible values, S(τ) gives the corresponding survival weight, and Z is the normalizing constant obtained by summing those weights over the possible initial ages. The resulting probabilities favor ages a run has a greater chance of surviving to. The adoption of either starting distribution says something about where observation began. It is separate from the later updates driven by the observations in the record.
Learning the parameters attached to each candidate run
The recurrence calls for a forecast from each possible current stretch. The authors show how to supply it using exponential-family likelihoods with conjugate priors. A likelihood describes how the observation is distributed at a specified parameter value. In this family, each observation enters the parameter-dependent part of the likelihood through a fixed set of functions. Adding their values over a stretch yields a summary that retains the information needed here about that stretch’s parameters.
P(x | η) = h(x) exp(ηᵀU(x) − A(η))
Here x is a possible observation and η is the vector of natural parameters. The probability or density P(x | η) describes x conditional on η. The function h(x) is the factor that depends only on the observation. The vector U(x) contains its sufficient-statistic contributions, and the superscript T transposes η so that ηᵀU(x) is their inner product. The function exp is the exponential, and A(η) normalizes the likelihood at each fixed η.
A(η) = log ∫ h(x) exp(ηᵀU(x)) dx
Here A is the log normalizer, log denotes the logarithm, and the integral ∫ runs over observations x with measure dx in the continuous case. The functions h and U and the vector η are those in the likelihood, and ηᵀU(x) is their parameter-statistic inner product. For discrete observations the normalization uses a sum over possible observations. The variable of normalization is the observation, since the likelihood must integrate or sum to one at a fixed η.
The authors’ expression for the normalizer is printed with a parameter differential, although the surrounding likelihood requires normalization over observations. The expression above follows that requirement. The practical distinction is between normalizing a likelihood over what could be observed and normalizing a parameter distribution over what its parameter could be. The method uses both operations, at different points.
Conjugacy means that the prior and posterior over the parameters have the same mathematical form. Multiplying this prior by the likelihood for a new value changes the quantities that index the parameter distribution. The posterior can then be stored in the same representation as the prior. This is especially useful here because several candidate runs need an update at every timestep.
P(η | χ, ν) = h̃(η) exp(ηᵀχ − νA(η) − Ã(χ, ν))
Here P(η | χ, ν) is the distribution over the parameter vector η specified by hyper-parameters χ and ν. A hyper-parameter indexes a distribution over parameters. In this case χ is a vector paired with η through the inner product ηᵀχ, and ν is a scalar multiplying the likelihood’s log normalizer A(η). The function h̃(η) supplies the parameter-dependent base factor. The term Ã(χ, ν) supplies the log normalizer of this parameter distribution, and exp exponentiates the resulting expression.
The update can be understood directly from these forms. Each observation contributes a term linear in η, so its sufficient-statistic vector can be added to χ. It also contributes another copy of the term involving A(η), so ν increases by one. The initial hyper-parameters come from the chosen prior, which is also what the algorithm uses for prediction in an empty run.
νₜ⁽ʳ⁾ = ν_prior + r
Here νₜ⁽ʳ⁾ denotes the count-like hyper-parameter built from a current run of length r through time t. The quantity ν_prior is its initial value from the parameter prior. The run length r counts the observations in the current stretch and thus counts the likelihood contributions to this hyper-parameter in the formula.
χₜ⁽ʳ⁾ = χ_prior + Σ_{i in the current run} U(xᵢ)
Here χₜ⁽ʳ⁾ is the sufficient-statistic hyper-parameter for the current run of length r at time t. The vector χ_prior is its value for an empty run. The index i ranges over observation positions in the run, xᵢ is the observation at position i, and U gives the contribution of that observation. The sum Σ adds those contributions. The paper uses a lower-case form of the statistic symbol in its update, with the same role as U here.
These subscripts label statistics available after processing observations through t. The paper’s algorithm labels the statistics by the upcoming prediction step when it writes the update. Under either labeling, a continuing state receives its predecessor’s statistics augmented by the new value. A reset state receives the prior statistics. This saves recomputing the sums for every possible stretch from the original observations whenever a new value arrives.
The independence assumption is what permits a full reset of these statistics. Earlier stretches can still inform the posterior weight of a candidate state because their observations were involved in reaching it. Once a reset has been taken, those stretches supply no contributions to the parameter statistics used for the new run. Thus, even histories with very different distributions before their final boundary can share the same forecast immediately after it.
Averaging a run’s forecast over its unknown parameters
The parameter posterior for a run represents a range of plausible values for η. The paper averages the possible forecasts over that range. In a short run, the prior can have considerable influence because few observation contributions have been added. A longer run can contain stronger evidence about its parameters. The predictive distribution incorporates that distinction without requiring the parameters to be fixed at estimates before forecasting.
P(xₜ₊₁ | rₜ = r, xₜ⁽ʳ⁾)
= ∫ P(xₜ₊₁ | η) P(η | rₜ = r, xₜ⁽ʳ⁾) dη
Here xₜ₊₁ is the candidate next observation and xₜ⁽ʳ⁾ is the stretch associated with the hypothesis rₜ = r at time t. The factor P(xₜ₊₁ | η) is the next-observation likelihood at parameter value η. The factor P(η | rₜ = r, xₜ⁽ʳ⁾) is the posterior density of that parameter given the specified run and its observations. The integral ∫ with parameter measure dη averages the likelihood over those parameter values. Its result is the forecast conditional on that run.
Conjugacy often makes this average a simple function of the stored statistics. The resulting predictive distribution can have a different mathematical form from the likelihood. This follows because the likelihood describes variation at a fixed parameter value, whereas the predictive distribution averages over remaining uncertainty about the parameter as well. The derivation uses the predictive probability or density directly in the recurrence. The run-length calculation needs no additional information about how it was obtained.
This separation is the basis of the authors’ modular implementation. The part specific to the observations supplies their predictive probabilities and knows which summaries to update. The part that tracks changepoints needs those probabilities, the gap prior, and the existing run weights. For one dataset the observation-specific calculation can ask how plausible a new value is given a recent estimate of its level. For another it can ask how plausible a count is given a recent rate. The same probability transfer between run lengths applies in both cases.
Averaging again over the possible run lengths
The final forecast combines the run-specific predictive distributions. At this stage the algorithm has already accounted for uncertainty in the parameters within each run. Now it accounts for uncertainty about the boundary itself. A particular run’s predictive distribution enters the mixture with the posterior probability assigned to its length.
P(xₜ₊₁ | x₁:ₜ) = Σ_r P(xₜ₊₁ | rₜ = r, xₜ⁽ʳ⁾) P(rₜ = r | x₁:ₜ)
Here xₜ₊₁ is the next value being forecast and x₁:ₜ is the entire observed prefix. The sum Σ_r ranges over candidate run lengths r. The first factor inside the sum is the forecast for the stretch xₜ⁽ʳ⁾ determined by the state rₜ = r. The second factor is the posterior probability of that state. Their sum yields a predictive distribution conditional only on what has already been observed.
This method can represent competing explanations even when the most probable one is clear enough to report on its own. Suppose the distribution places substantial support on a recent shift in level while retaining some support for continuation at the earlier level. The forecast receives contributions from both levels. Its spread then reflects both uncertainty about what values occur within each run and uncertainty about which run is current. A plot of the predictive mean and spread is a compact view of that mixture and does not display all of its shape.
There is no stage here in which a separate labeled collection of changepoints is used to train a detector. The procedure is set up with a likelihood for each stretch, a prior for its parameters, a gap prior, and a starting condition. Given these choices, the data arrive in sequence. The recurring learning step is the update of the parameter distribution for every candidate run, together with the update of the probabilities of the runs themselves. In the empirical examples the authors specify the distributions and settings they use and process the observations as ordered records.
How the work grows with the record
The exact procedure retains every candidate run length. At each step, it scores the new observation for each previous state, transfers the corresponding weights, and updates the summaries. Each prior state sends a weight to at most two destinations. As a result, the per-step computation and storage are linear in the amount of data seen so far, given the fixed-size summaries in the authors’ implementation. The sparse transition avoids the cost that would arise if every old state could lead to every new state.
The authors describe a way to reduce the amount of work in ordinary use. A tail of long-run candidates with very little total posterior probability can be dropped. They give 10⁻⁴ as an example threshold for that tail mass. When the active range stays short, the average work per iteration is of the order of the expected run length. The worst case still grows linearly with the number of observations because the probability of long runs can remain substantial.
Discarding a tail changes which states are available for subsequent updates. The exact calculation described by the paper is the one that carries the full necessary distribution. The tail rule is an optional approximation to that calculation. The paper gives a complexity argument for the rule and leaves open its empirical effects on forecasting or detection in the example datasets.
Experiments and results
What the figures measure
The paper applies the sequential procedure to well measurements, stock index returns, and coal mine disaster counts. Each example pairs the time series with a display of posterior run-length probabilities. The figures illustrate how changing the likelihood and prior for the segment parameters changes the aspect of the data the procedure can track. The same type of gap prior is used throughout, with a different timescale for the mining example.
The run-length panels display probabilities on a logarithmic color scale. Darker pixels represent higher posterior probabilities. At a given time, the vertical pattern shows the lengths that remain plausible. Following a high-probability trajectory across time shows whether the evidence continues to support a boundary in roughly the same place or shifts toward a newer boundary. A run that remains plausible as observations arrive grows longer along that trajectory. The horizontal axis orders the sequential updates, and the vertical one counts elapsed observations in a candidate run.
The observation panels provide complementary information. In the well example, the paper plots the predictive mean and spread, so the location and uncertainty of the forecast can be read together. In the market example, a predictive standard deviation shows changes in the anticipated size of returns. In the mining example, the cumulative count helps the reader see changes in how quickly the events accumulate. Each panel uses quantities related to the particular application. The authors report no common error score, labeled boundary benchmark, or numerical ranking of competing methods.
The well log and shifts in mean
The well record contains 4050 measurements of nuclear magnetic response acquired during drilling. The measurements help characterize the rock around the well. The authors describe shifts in the average response as reflecting the stratification of the earth’s crust. This makes the data a setting in which a change in level has a concrete interpretation. A sustained movement in the measurements is consistent with a new stretch whose readings have a different average response.
The authors analyze the readings with a univariate Gaussian likelihood in which the mean can vary from run to run. Univariate means that the likelihood describes a single measurement at each step. The reported prior parameters are μ = 1.15×10⁵ and σ = 1×10⁴. They use a geometric gap prior with λ_gap = 250. The prior parameters for the measurements and the prior over boundaries serve separate purposes. The former give the starting information for the prediction of readings from a fresh run. The latter influences the weight assigned to ending or continuing any current run.
The figure displays a 1100-datum subset. The chart below compares the coverage of that display with the coverage of the full well record used in the example. Observation count is the only measure in the chart. A larger count means more of the record is represented, and the display is a view of the run on the well data.
Observation coverage in the well-log analysis and its displayed subset
The figure presents a subset of the well-log record analyzed by the authors.
The numbers
| System or setting | observations |
|---|---|
| Displayed subset | 1100 |
| Full record analyzed by the algorithm (this paper) | 4050 |
The top panel overlays the predictive mean and 1-σ error bars on the observed values. The predictive mean follows the level that the mixture expects. The bars express its predictive standard deviation around the mean. The paper’s qualitative finding is that inferred returns to short runs accompany abrupt shifts in the observed level. It also reports that the predictive variance rises just after an apparent changepoint, consistent with having fewer observations available to estimate the parameters of the new stretch.
The two panels make that account easier to follow. During a relatively stable stretch, the forecast draws on observations compatible with its current level and the high-probability run ages grow. When a new level is supported, the forecast comes to depend on observations from a shorter stretch. The widening spread is part of the result. With less evidence about the parameters in that stretch, the updated prediction reflects greater uncertainty.
Earlier changepoint studies by Ó Ruanaidh and Fitzgerald and by Fearnhead and Clifford used these well data, according to the authors. The paper cites that history as context for the choice of series. It does not report a side-by-side run against those analyses or give a score for agreement with an independently labeled sequence of geological boundaries. Its reported correspondence between the visible shifts and the run-length display is qualitative, and the plotted forecast gives the accompanying behavior of the predictive uncertainty.
Dow Jones returns and shifts in volatility
For the market example, the authors use the Dow Jones Industrial Average’s daily returns for the period beginning July 3, 1972 and ending June 30, 1975. The authors turn successive closing prices into returns before applying the inference procedure. The calculation expresses each price relative to the preceding closing price and centers the resulting ratio at zero.
Rₜ = pₜᶜˡᵒˢᵉ / pₜ₋₁ᶜˡᵒˢᵉ − 1
Here Rₜ is the return at trading observation t. The quantity pₜᶜˡᵒˢᵉ is the closing index price at t and pₜ₋₁ᶜˡᵒˢᵉ is the closing price at the preceding trading observation. Dividing the current close by the preceding one gives a relative price, and subtracting 1 gives the return. The time axis in the figure counts business days.
In this example, a zero-mean Gaussian likelihood gives each stretch a constant but unknown variance. A new run can have a different variance. Fixing the mean at zero directs the analysis towards changes in volatility. Returns in either direction can provide evidence of greater spread. A series with similar average returns over two periods can still have different predictive standard deviations if the typical magnitudes differ.
The authors use a gamma prior on inverse variance, with a = 1 and b = 10⁻⁴, and set λ_gap = 250. Inverse variance is also called precision. Higher precision corresponds to a narrower distribution of returns. The data update the distribution of that precision separately for each possible run. The forecast combines the resulting run-specific predictions according to their posterior weights, and its standard deviation is the volatility measure displayed in the figure.
The paper places the return series and the predictive volatility above the posterior run-length panel. The two displays can be read together. The volatility curve shows how large an upcoming return is expected to be in terms of spread. The run-length probabilities show which stretches of past returns are plausible sources for that estimate. A large return on its own can still be compatible with an ongoing high-variance run. A collection of observations that fits a recently started high-variance stretch better can give the shorter run more weight.
The authors indicate when the court convicted G. James W. as well as Gordon Liddy. McCord, Jr. on 30 January 1973, on 19 October 1973 when OPEC put the United States under embargo, and on 9 August 1974 when Nixon resigned as president. These are dated annotations for reading the plot. They are separate from the returns that enter the inference, and the paper provides no estimated effect of each event. The sequence of posterior probabilities can be inspected near each date without treating temporal proximity as evidence about the cause of a volatility change.
The authors mention that Hsu studied variance changes in a subset of the same market data with frequentist techniques and weekly returns. That is a related analysis, with a different observation frequency. The comparison in the paper is contextual. It gives the reader no numerical test of forecast quality against Hsu’s procedure and no common detection score. The result it shows is that the online recurrence can be coupled to a changing-variance likelihood and yield a volatility forecast together with a distribution over the age of the current regime.
Coal mine disasters and shifts in event rate
The mining data are dates of coal mine explosions recorded by Jarrett. The series covers March 15, 1851 to March 22, 1962, and includes disasters that killed at least ten people. The authors represent the events as weekly counts and use a Poisson process. Each stretch is characterized by an event rate. With time divided into weeks, the rate governs the count distribution for a week in that stretch.
This example changes both the observations and the substantive meaning of the fitted quantity. The input is a count of documented disasters rather than a continuously varying instrument reading or return. The rate sets the expected frequency of events. Weeks with no disaster still carry information about that rate. A long stretch with sparse events can support a low rate, whereas an isolated quiet week can remain plausible under a higher one. The forecast weighs these possibilities across the candidate stretches.
The authors assign the rate a gamma prior with a = b = 1. They use λ_gap = 1000 for the geometric gap prior. This setting gives the mining analysis a longer prior timescale for a run, measured in weekly updates. The corresponding timescale for the market example is expressed in trading observations, and the well analysis advances by measurements. Each value governs the boundary probability in its own sequence of updates.
The upper panel of the mining figure displays the cumulative count of disasters. A stretch of the cumulative curve with a steeper average slope corresponds to more frequent events. A flatter average slope corresponds to less frequent events. The cumulative display helps make a change in local frequency legible even when individual events are sparse. The lower panel shows the posterior run lengths from the weekly data, allowing the reader to inspect whether the distribution begins favoring newer runs around changes in the slope.
The figure shows when the Coal Mines Regulations Act was introduced in 1887. The paper places that year at weeks 1868 to 1920 on the plotted time axis. The annotation spans a range of weeks, which is useful context when comparing a historical date to an inferred change with uncertain timing. The input to the recurrence is the event sequence. It contains no variable representing the Act, so the figure supplies no separate estimate of the Act’s effect on the event rate.
The authors report the mining example through the cumulative count and the posterior run-length display. They give the event definition, observation period, aggregation interval, and priors. They do not attach a numerical forecast error to the series or report a numerical comparison with another detector. The demonstration shows how the same inference over run lengths can be paired with a count process in which the changing quantity is event frequency.
What the demonstrations have in common
Each example is an application of the same calculation to a different kind of change. The well analysis allows the level to move, the market analysis allows the spread to move around a fixed center, and the mining analysis allows the rate of events to move. The distinction matters because the method can only recognize change through the predictions it is given. The likelihood makes a particular kind of recent history predictive, and the gap prior regulates how readily the algorithm discounts an older history.
The figures provide a view of that interaction. They show how strongly the observations support possible ages of the current stretch and, where the authors overlay a forecast, how the predicted level or spread evolves. Their most direct empirical observation about detection is the visual correspondence between the well-log shifts and the inferred short runs. The other examples broaden the demonstration to variability and count rates. Taken together, they establish that the same inference procedure can run with those different observation assumptions and produce interpretable sequential outputs.
What the ablations show
The paper reports no ablation study or controlled comparison and instead offers a hypothetical run-length example, a complexity analysis, and visual demonstrations on the three real sequences.
The mechanics illustrated by a hypothetical sequence
The hypothetical sequence changes in mean at known boundaries because the authors construct it for illustration. The displayed completed stretches have lengths 4 and 6, and the final stretch is open. These lengths measure observations within the constructed segments. In the associated run-length trajectory, the value grows during each stretch and resets at a boundary. That illustration gives a direct interpretation of the hidden variable before the paper shows how its posterior looks when the boundaries are unknown.
The accompanying diagram shows the paths over which joint weights pass. Only one predecessor feeds a positive length, while all immediate predecessors can feed the reset. This diagram explains the computation without relying on the properties of a particular likelihood. It also makes clear why the recurrence can summarize multiple earlier histories as one current state. The illustration concerns the structure of the update. It includes no trial in which different detectors compete to recover the constructed boundaries.
What the changes of likelihood demonstrate
The use of three likelihoods shows which part of the calculation depends on the domain. A normal observation with an unknown mean calls for a prediction about level. A return drawn from a zero-mean distribution with unknown variance calls for a prediction about spread. A weekly count calls for a prediction about an event rate. When the algorithm scores an arriving observation under its candidate runs, those differences govern what counts as support for each run. From that point onward, the weights go through the same growth and reset calculation.
The well example offers the clearest qualitative check on the interpretation of the posterior. Short runs become plausible around visible changes of level, and the increase in predictive variance is consistent with the loss of the longer stretch as a source of parameter information. The two observations belong together. Treating a boundary as plausible changes both which readings contribute and how many readings contribute. The paper’s plot shows the associated behavior of the predicted mean and spread.
The use of different datasets also places a limit on the comparison. Changing from well measurements to returns changes the kind of observation, the likelihood, and the quantity whose variation matters. The mining example changes the gap-prior timescale as well. These differences are appropriate for demonstrating modularity. The figures cannot isolate the effect of any single choice on forecast accuracy or infer which part accounts for a measurable improvement.
What the complexity argument establishes
The contrast between full inference and tail truncation is analytical. With all states retained, the active range expands with the amount of data seen. With a low-mass tail removed, the active range can often stay closer to the lengths that carry substantial posterior probability. The authors give the resulting average and worst-case behavior in terms of run length and record size. They report no runtime measurements or experimental variation of the threshold.
The proposed truncation therefore illustrates a tradeoff available to an implementation. It can spend work maintaining unlikely long histories, or discard a tail and accept that the update now operates on fewer states. The paper supports the computational side of that tradeoff with the structure of the recurrence. The examples provide no measured change in forecasts from using the threshold and no measured frequency with which long-run states survive it. The paper likewise gives no controlled comparison of alternative hazards, parameter priors, or initial conditions. Its evidence for the method combines a derivation with demonstrations, which supports different claims from an empirical attribution of gains to individual components.
Limitations
The scope the authors specify
The authors derive exact inference under a specific account of how a sequence is generated. Observations in a stretch must be independent given their shared parameters, and the parameters of successive stretches are independent draws from their prior. Their algorithm focuses on the most recent boundary because those assumptions make its location sufficient to identify the observations relevant to the current parameters. If information about parameters carried across boundaries, histories with the same latest boundary could still differ in what they predict.
Within a stretch, conditional independence gives a direct way to collect evidence in sums of sufficient statistics. A sequence with dependence between successive observations may need a different predictive calculation and a different representation of what must be retained from the past. The examples demonstrate the relatively simple observation assumptions that the authors specify. The exactness claim applies to the recurrence and its probability assumptions, so it says how the posterior is calculated for a given specification.
The authors also distinguish an exactly available predictive distribution from settings where one might need an approximation. They mention compact approximations as a possibility and address the exact case in their own derivation. Conjugate exponential families are especially convenient because the statistics for the current stretch can be updated without revisiting its full contents. A setting without those compact summaries can still pose a sequential prediction problem, but the storage and computation claims for the displayed implementation rely on the representation the paper gives.
A further limit concerns the size of the run-length distribution. Its full, exact update grows in cost with the record. The proposed tail cutoff can reduce the average work, although the authors retain the linear worst case. A long stable stretch is precisely a case in which long-run possibilities can matter and the active range may stay large. The paper supplies a cost argument and an example threshold, leaving the practical effect of truncation on probability estimates unevaluated.
What follows from the experimental setup
The examples are enough to show how the inference behaves with the stated choices, including how forecast uncertainty and inferred run age change through the records. They give no quantitative basis for concluding that it finds more true boundaries, yields fewer false alarms, or forecasts more accurately than the earlier methods discussed in the paper. Such claims would need a comparison with a common target and metric. The reported visual figures answer questions about how the output behaves on particular series.
The gap prior also has a visible interpretive role. Its hazard supplies the reset probability before the current observations decide which histories are more credible. All three studies use a constant hazard within their respective runs of the algorithm. An age-dependent hazard is available in the derivation, but the reported examples give no comparison of how alternative hazard shapes affect the results. In a particular application an analyst could reasonably want to know how much a short-run pattern depends on the prior timescale, and the paper offers no sensitivity measurements for that question.
The same issue applies to what counts as a change. The well likelihood gives the observations a way to support different means across stretches. The market likelihood gives them a way to support different variances, with its mean specified in advance. The mining likelihood represents changes through the rate of the weekly counts. If the true source of variation acts differently from the changing quantity allowed by these assumptions, a short-run posterior can still be a useful description of how the observations fit the chosen likelihood. It gives limited evidence about the underlying mechanism on its own.
The forecasts are conditional on the choice to represent shifts as abrupt boundaries between stretches. A gradual evolution in a mean, variance, or rate could make a sequence of shorter constant stretches plausible. The posterior would then express evidence for recent starts under that representation. The paper’s illustrations concern abrupt change, so their behavior does not resolve how to distinguish a physical jump from gradual variation that a piecewise-constant description can approximate.
The historical annotations have a separate evidential limit. The market calculation uses returns and the mining calculation uses event counts. The named events supply context for interpreting the timing in the figures. No variables in those analyses encode the events as possible causes, and there is no comparison with what would have happened in their absence. Consequently the papers’ displays can suggest places to examine the series more closely, while the relationship between the inferred shifts and the historical events remains open.
The posterior is also distinct from a prescribed alarm. A reader can see where probability begins to favor recent boundaries, but an operational decision must account for how much uncertainty is acceptable and how the costs of missed and premature alarms differ. The paper’s main output, the full filtering distribution, can inform such a decision. The empirical section supplies no alarm threshold or measurement of the delay between a verified change and an alert. Similarly, selecting the most plausible run length at every step yields a sequence of online estimates. A joint retrospective estimate of all boundaries would require a different calculation using evidence beyond the time of each estimate.
Finally, exact calculation and empirical reliability concern different questions. The recurrence gives the posterior dictated by the likelihood and priors. Its predictive calibration, its detection performance across cases, and its robustness to departures from the assumptions require observations or controls that the paper does not report. The strongest conclusion supported here is that the authors derive the sequential probability calculation and show its operation on distinct kinds of data, with an interpretable response to the visible shifts in the well series.
What came after
The subsequent research record is unavailable here, so no specific later extension can be attributed to the paper. Its documented contribution is the combination of a posterior over current run lengths with a forecast that averages over those lengths. The paper also establishes the implementation boundary that makes the calculation reusable. The same run-length update accepts different ways of predicting the next observation from the data in a candidate stretch, as demonstrated with changes in level, volatility, and event rate.
Cite
Cite as Ryan Prescott Adams and David Mackay. 2007. Bayesian Online Changepoint Detection. arXiv (Cornell University).
@misc{adams2007bayesian,
title = {{Bayesian Online Changepoint Detection}},
author = {Ryan Prescott Adams and David Mackay},
year = {2007},
doi = {10.48550/arxiv.0710.3742},
eprint = {0710.3742},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.0710.3742}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/adams-2007-bayesian-online-changepoint-detection/