Time Series: Stationarity, Autocorrelation, and Mean Reversion

Why prices wander but spreads can come home: stationarity, autocorrelation, unit roots, mean-reversion half-life, and Hurst exponents — the statistics behind SurgeFlow's ML pairs research.

Category: Statistics

Why prices wander but spreads can come home

A time series is stationary when its statistical character — its average level, its variability, the way it echoes its own past — does not drift as time passes. Sampled today or next year, it looks like draws from the same underlying process. Stationarity matters because nearly every familiar statistical tool (means, standard deviations, correlations, regressions) quietly assumes it. Stock prices flunk the requirement: a price has no fixed level to return to, its variance grows with the horizon, and this year's average tells you little about next year's. Returns come closer to stationary, which is why analysis is usually done on returns rather than prices. The more interesting case is a spread: two stocks in the same industry, exposed to the same customers and costs, can each wander freely while the gap between them stays tethered. When a combination of non-stationary prices is itself stationary, the pair is called cointegrated — and it is the stationarity of the spread, not of either price, that makes mean-reversion statistics meaningful. That distinction is the entire foundation of SurgeFlow's pairs research.

The mechanics: random walks, AR(1), and half-life

The workhorse model is the first-order autoregression, AR(1): x_t = c + phi * x_(t-1) + e_t, where x_t is today's value, x_(t-1) is yesterday's, c is a constant, phi is the persistence coefficient, and e_t is random noise. Everything hangs on phi. If |phi| < 1, the series is stationary and shocks fade; if phi = 1, you have a unit root — the random walk x_t = x_(t-1) + e_t — where shocks never fade and the series has no home to return to. Unit-root procedures such as the augmented Dickey-Fuller (ADF) statistic ask whether the data can reject phi = 1. Around that core sit four related ideas: - Autocorrelation at lag k: rho_k = Cov(x_t, x_(t-k)) / Var(x_t) — how strongly the series echoes itself k steps back. Positive autocorrelation in returns is the statistical skeleton of momentum; negative autocorrelation, of reversal. - Mean-reversion half-life: fit the change Delta x_t = a + b * x_(t-1) + e_t. If b lies between -1 and 0, half_life = -ln(2) / ln(1 + b) — the time for a deviation to shrink halfway back. This is the discrete analogue of an Ornstein-Uhlenbeck process dx = theta * (mu - x) dt + sigma * dW, whose half-life is ln(2) / theta. - Hurst exponent H: from the scaling law Var(x_(t+tau) - x_t) proportional to tau^(2H). H near 0.5 looks like a random walk; H below 0.5 suggests mean reversion; H above 0.5 suggests trending behaviour. - Spurious regression: regress one random walk on another, entirely unrelated one, and you will frequently see a high R-squared and an impressive t-statistic — Granger and Newbold demonstrated this in 1974. It is the canonical reason to check spreads for stationarity rather than admire a price-on-price regression.

How SurgeFlow applies it

The /ml section carries SurgeFlow's pairs research. Within each market, same-sector pairs are screened, and the table reports the statistics this article just built: an Engle-Granger p-value (the two-step procedure — regress one price series on the other, then run a unit-root check on the residual spread), a half-life from an Ornstein-Uhlenbeck-style fit to that spread, a Hurst exponent on the spread, and the spread's current z-score, meaning how many standard deviations it sits from its historical mean. Restricting to same-sector pairs is deliberate: cointegration wants an economic reason to exist, and shared industry exposure is the plainest one. Elsewhere on the site, the momentum boards are the flip side of the same coin — momentum is, at heart, the observation that positive autocorrelation in relative returns has tended to persist. What SurgeFlow does not do: it does not say a spread will converge, when, or by how much; it does not execute or recommend trades; and every statistic on the page is an in-sample estimate from historical prices. A pair can pass every check today and decouple tomorrow. This is research infrastructure, not investment advice.

What SurgeFlow data this uses

The pairs and momentum statistics are computed from daily adjusted price and turnover history across the four markets SurgeFlow covers: the United States, China, Japan and Hong Kong. Provenance: FMP supplies US prices; Tushare covers China and Hong Kong; and Japan combines J-Quants price data with EDINET filings. Two data caveats matter more for spread statistics than for almost anything else on the site. First, corporate actions: an unadjusted split or dividend shows up as a spurious jump in a spread and can fabricate or destroy "cointegration". Second, unit consistency: UK stocks quote in pence, and mixing pence with pounds silently scales a series a hundredfold — exactly the kind of error a cointegration statistic will not warn you about. SurgeFlow treats continuous price and turnover history as mandatory for every listed ticker; fundamentals may have gaps, but price history may not.

Reading the pairs table without fooling yourself

A pairs table is, by construction, a machine for generating multiple-comparison problems, so read it defensively: - Selection effects: screen enough pairs at a 5% p-value threshold and some will pass by luck alone. A small Engle-Granger p-value is a lead worth investigating, not a verdict. - In-sample bias: half-life and Hurst are fitted on the same history that nominated the pair. Out-of-sample, both routinely deteriorate. - Structural breaks: mergers, index changes, business pivots, and regime shifts can end a cointegrating relationship without notice; the statistics will keep describing a relationship that no longer exists until the estimation window rolls past it. - Z-score assumptions: a z-score presumes the spread's mean and variance are stable. If the relationship has broken, "three standard deviations from the mean" is measuring distance from a mean that is no longer there. - Half-life noise: half-life estimates from OU fits carry wide confidence bands at realistic sample sizes; treat them as order-of-magnitude descriptions (days versus months), not precision figures.

Explore it yourself

All of the series behind these statistics are available through the SurgeFlow public API. A free (beta) key from /account allows 2,000 requests per day, and the full endpoint catalogue is documented in the OpenAPI specification at /api/public/openapi.json. A natural exercise: pull daily adjusted closes for two same-sector names, form the log-price spread, run your own ADF check and OU fit, and compare the results against the /ml pairs table. Reproducing the numbers — and then watching how they change when you shift the estimation window — teaches more about the fragility of these statistics than any write-up can. The data is offered for research and education, not as advice.

Sources and further reading

Primary, academic, and SurgeFlow data references for the claims above: - Engle, R. F. and Granger, C. W. J. (1987), "Co-integration and Error Correction: Representation, Estimation, and Testing", Econometrica. - Dickey, D. A. and Fuller, W. A. (1979), "Distribution of the Estimators for Autoregressive Time Series with a Unit Root", Journal of the American Statistical Association. - Granger, C. W. J. and Newbold, P. (1974), "Spurious Regressions in Econometrics", Journal of Econometrics. - Uhlenbeck, G. E. and Ornstein, L. S. (1930), "On the Theory of the Brownian Motion", Physical Review. - Hurst, H. E. (1951), "Long-Term Storage Capacity of Reservoirs", Transactions of the American Society of Civil Engineers. - Lo, A. W. and MacKinlay, A. C. (1988), "Stock Market Prices Do Not Follow Random Walks: Evidence from a Simple Specification Test", Review of Financial Studies. - Gatev, E., Goetzmann, W. N. and Rouwenhorst, K. G. (2006), "Pairs Trading: Performance of a Relative-Value Arbitrage Rule", Review of Financial Studies. - Jegadeesh, N. and Titman, S. (1993), "Returns to Buying Winners and Selling Losers: Implications for Stock Market Efficiency", Journal of Finance. - SurgeFlow: the /ml pairs research tables; API key at /account; OpenAPI specification at /api/public/openapi.json.