I'm working with a time series data from neuron firing rate. This time series is usually overall non-stationary due to experimental noise. However, I want to extract stationary section in this overall non-stationary time series. People in the field usually just distinguish stationary section manually.

However, I want to implement a program that can automatically extract stationary section from a time series. Can you suggest some statistics test or algorithms that can regconize stationary section in a time series? For example, in this graph, I want to extract the stationary section from 400 to 1200. Thank you very much! enter image description here

  • $\begingroup$ @Stats Does your suggested approach assume there are no outliers as unusual values can distort changes in intercepts (level/step shifts) or changes in slopes(trends) . Does it make assumptions about the form of the arima structure ? Does it make assumptions about the error variance changing either stochastically or deterministically at particular points in time ( not necessarily where the expected value changes) ? Does it extend to models with stochastic predictors or is it a pure univariate approach.. Upon re-reading tour comments it appears that you are suggesting that one stabilize the vari $\endgroup$
    – IrishStat
    Mar 15, 2019 at 17:25
  • $\begingroup$ Assumes $f_t$ is a deterministic, one-dimensional, piecewise-constant signal (note trends can be accommodated too) with change-points whose number $N$ and locations $η_1,...,η_N$ unknown. Also that random sequence $\{ε_t\}$ i.i.d. Gaussian with mean zero and variance 1 and that The sequence $\{f_t\}$ bounded. A few other technical assumptions wrt locations of change points. No ARIMA structure is assumed, variance can be stabilized (e.g. via Haar-Fisz transform) prior to detection. For further info do read paper arxiv.org/pdf/1411.0858.pdf $\endgroup$
    – Stats
    Mar 15, 2019 at 17:32
  • 1
    $\begingroup$ Could you please explain to us what you mean by a "stationary section"? In a time series context this refers to an invariance property of the joint distribution under a time shift, but that is such a severe condition that I suspect you might mean something far less restrictive, such as "constant mean." $\endgroup$
    – whuber
    Mar 15, 2019 at 17:51
  • $\begingroup$ @Stats Do you have to pre-specify T and can you specify a level of confidence OR a minimum step size in order to minimize false positives or meaningless shifts ?. These things and others including variance change break-points are discussed here docplayer.net/… some 30 years ago while your reference is 5 years ago. If you are not identifying possible companion arima structure your suggested approach could easily be confused by stochastic trends which appear to be assumed away in this approach. $\endgroup$
    – IrishStat
    Mar 15, 2019 at 18:13
  • $\begingroup$ @IrishStat There is a minimum step size, and it is the one we see in statistical signal processing literature. Specifically, the magnitudes $f'_i$ of the jumps satisfy $\min_{i=1,...,N} f′_i ≥ \underline{f}_{T}$ , where $\sqrt{\delta_T}\underline{f}_{T}≥ C \sqrt{\log T}$ for a large enough C, and $\delta_T$ is the lower bound of the minimum spacing between changepoints. This paper assumes constant variance, but variance can be stabilised, break- points is what this algorithm identifies. The whole essence of the procedure is piecewise and ARIMA can't be a good model for this case. $\endgroup$
    – Stats
    Mar 15, 2019 at 19:15

1 Answer 1


First, as I don't see any long stationary section on your data (the part "from 400 to 1200" is definitely not stationary) I have come to understood that what you do look for is for areas where the trend evolves in a similar way.

One way to so is by using a change point algorithm. One such algorithm can be found at P. Fryzlewicz, WILD BINARY SEGMENTATION FOR MULTIPLE CHANGE-POINT DETECTION (note there is a package called WBS available at CRAN)

Consider a simple model with change-points of the form

\begin{equation} X_t = f_t + ε_t, \qquad t = 1, . . . , T, \end{equation}

where $f_t$ is a deterministic, one-dimensional, piecewise-constant signal with change-points whose number N and locations $η_1, . . . , η_N$ are unknown. The sequence $ε_t$ is random and such that $\mathbb{E}(ε_t)$ is exactly or approximately zero. A suitable algorithm would estimate $N$ and $η_1, . . . , η_N$ under various assumptions on $N$, the magnitudes of the jumps and the minimum permitted distance between the change-point locations.

So WBS works this way:

In the first stage we randomly draw a number of subsamples i.e. vectors $(X_s, X_{s+1}, . . . , X_e)$, where $s$ and $e$ are integers such that $1 ≤ s < e ≤ T$, and compute the CUSUM statistic on each subsample. We then maximise each CUSUM, choose the largest maximiser over the entire collection of CUSUMs, and take it to be the first change-point candidate to be tested against a certain threshold. If it is considered to be significant, the same procedure is then repeated recursively to the left and to the right of it. The hope is that even a relatively small number of random draws will contain a particularly ‘favourable’ draw in which, for example, the randomly drawn interval $(s, e)$ contains only one change-point, sufficiently separated from both $s$ and $e$: a set-up in which our CUSUM estimator of the change-point location works particularly well as it coincides with the maximum likelihood estimator (in the case of $ε_t$ being i.i.d. Gaussian). We provide a lower bound for the number of draws that guarantees such favourable draws with a high probability. Apart from the threshold-based stopping criterion for WBS, we also introduce another, based on what we call the strengthened Schwarz information criterion.

And that is a practical example

enter image description here

However note, the assumptions of the algorithm might not be satisfied by your data (especially the constant Gaussian variance of the error term). Hence, you may want to stabilize the variance first for more efficient estimation of the change-points.

  • $\begingroup$ .................................................................................................... $\endgroup$
    – IrishStat
    Mar 15, 2019 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.