Quant500 Academy

2. Stationarity: not the price, almost the return

Level 5: Time series: why the past does not repeat itself the same way

A share trading at 50 ten years ago may trade at 300 today.

There is no fixed level around which that price oscillates in a stable way. And a good part of the statistical machinery you have used so far takes for granted that there is one.

The property almost everything takes for granted

Computing a mean and trusting that it reasonably represents the near future. Estimating a correlation and expecting it to remain valid. Fitting a regression and using it to predict.

All of those operations implicitly require that the statistical properties of the data do not change over time.

That property is called stationarity, and it deserves a precise definition, because almost everything that comes later in this level depends on understanding it well.

The three conditions, one by one

A time series is (weakly) stationary if three conditions hold simultaneously:

When all three hold at once, it makes sense to compute a single number — a mean, a variance, a correlation — and treat it as a reasonably stable description of the process generating the data.

The price meets none of the three

A share's price practically never meets any of the three conditions above.

Its mean is not constant. The example at the start is enough to see it: with the price drifting from one level to a completely different one over the years, there is no stable value around which it oscillates.

Nor is its variance constant, in a very specific sense that is often overlooked. If the price evolves as a cumulative sum of approximately random increments — the random walk idea formalized by the next module — the uncertainty about where the price will be in t days' time grows roughly in proportion to t. It does not stay fixed.

That is, the further ahead you look, the wider the plausible range of prices, which in itself violates the constant variance condition.

And the very notion of correlation with itself at a fixed lag loses its meaning when the mean is continuously moving.

The return behaves differently

The return — the percentage change from one period to the next — behaves very differently and comes much closer to stationarity, though not perfectly.

Consider a share whose price goes from 100 to 105, then to 110, then falls to 108, then rises to 115.

The price sequence itself (100, 105, 110, 108, 115) has no fixed level around which to oscillate, it keeps drifting. But the corresponding returns (+5%, +4.76%, -1.82%, +6.48%) do oscillate around a relatively stable level, with no obvious systematic tendency to grow or shrink over time.

This is the practical reason why, in quantitative analysis, almost all serious statistical work is done on returns, or on their logarithmic version, and not directly on prices. Returns are the transformation that brings the data closer to the stationarity that statistical tools need.

Differencing: the name of the transformation

That transformation has a name of its own: differencing.

Taking the difference between a value and the previous one — or, in the case of prices, the percentage change — is the most usual way of turning a non-stationary series into one that behaves reasonably well.

Logarithmic returns are the logarithm of today's price minus the logarithm of yesterday's price. They are a particularly convenient variant for two reasons:

The technical detail of why that happens is not essential for what follows in this level. It is enough to retain that working on the scale of changes, and not on that of levels, is standard practice.

Spurious correlation: the price of ignoring it

The consequence of ignoring all this is a phenomenon with a name of its own: spurious correlation.

Take two price series that are each, separately, a random walk with no causal relationship whatsoever between them: two companies from completely different sectors, say.

If you compute the correlation between their price levels over several years, it is perfectly possible to obtain a high correlation, of the order of 0.8 or 0.9, simply because both series tend to drift, each in its own way, during the period, without any real economic link existing between them.

That correlation does not reflect a genuine relationship, but an artefact of both series being non-stationary.

It is exactly the kind of error that makes two shares look as if they had something in common only because the market in general rose during the period studied, dragging both along.

There are two correct ways of avoiding it:

Coming close to stationarity is not meeting it

One final important warning remains, and it is worth reading slowly.

Saying that returns come close to stationarity does not mean that they are strictly stationary.

The variance of returns changes over time in a systematic way, with periods of calm followed by turbulent periods. That technically violates the constant variance condition, and it is precisely the volatility clustering phenomenon dealt with later on.

In addition, there are genuine structural changes that can permanently shift the mean or the variance of a particular asset's returns:

That is why in practice one usually speaks of local or approximate stationarity, valid within a reasonable time window, rather than of an absolute and eternal property of financial data.

That idea of validity limited in time is the one the level's final module will take up again.

The rest of Quant500

What you are learning, applied to the index every day:

The model portfolio, weekly in your inbox

Every Saturday, its week in one minute: how it went, the best and the worst, and which insiders bought with their own money. Plus, the day the model is rebuilt, which stocks come in and which go out. A simulation, not advice. At most one email a week, no ads, no account; one-click unsubscribe. Made by one person: Pol Gracia.

A model portfolio with simulated results, not a personalized recommendation. Your email is used for this only: privacy.

Behind the Academy and the rest of Quant500 there is one person: Pol Gracia Serrahima.