stationary and non-stationary time series, part 1 : introduction
time series are at the heart of quantitative finance. whether it is for asset pricing, risk modeling, market anomaly detection, or the construction of trading strategies, it is essential to understand their dynamics and the advanced techniques to exploit them effectively.
in this guide, we will cover the different transformations of time series, the fundamental problems in finance, and the application of advanced machine learning to solve them.
what is a time series?
a time series is a sequence of values measured chronologically at regular intervals. in finance, they are found everywhere: stock prices, returns, trading volumes, exchange rates, implied volatility… unlike classic tabular data, time series have temporal dependencies, which means that the current value is often influenced by past values: Xt depends strongly on X{t-1}, X{t-2}…
examples of time series in finance:
- asset price (Xt): the price of the s&p 500 follows a non-stationary stochastic dynamic.
- returns (rt=Xt−X{t-1}): often stationarized series, but with conditional volatility.
- credit spreads: dependent on economic cycles.
- interest rates: yield curves requiring specific models (vasicek, cir, etc.).
analyzing time series often involves transforming the data to make them usable by predictive models.
types of time series in finance and their challenges
in quantitative finance, properly classifying time series based on their statistical properties is crucial to applying the right transformations and predictive models. financial time series can be classified into several categories, each presenting specific challenges:
here is a detailed summary of the most common financial time series, classified according to three major criteria:
- stationarity vs. non-stationarity (covered in this article)
- conditional heteroscedasticity
- other specific characteristics (seasonality, extreme jumps, long memory, etc.)
stationary time series
a time series is stationary if its three statistical properties remain constant over time:
a) constant mean: measures whether the series oscillates around a fixed value, meaning no upward or downward trend.
- example: daily returns of s&p 500 stocks oscillate around 0% over the long term.
b) constant variance: measures how much a series fluctuates around the mean. if the magnitude of fluctuations remains stable over time, then variance is constant.
- example: stabilized interest rates.
c) constant autocorrelation: measures to what extent past values influence future values of the time series. if past values do not strongly influence future values, autocorrelation is stable.
- example: random return movements.
non-stationary time series
a time series is non-stationary if at least one of the three properties changes over time (e.g., an underlying trend or structural shocks), making these series difficult to model directly. they are often transformed to be made stationary.
a) non-constant mean due to trend
- example: stock prices increase over the long term.
b) non-constant variance
- example: inflation and interest rates.
c) unstable autocorrelation due to macroeconomic shocks
- example: the 2008 financial crisis on credit spreads.
problem
it is difficult to apply classical forecasting models without prior transformation.
solution
apply a transformation. for example, for stock prices, we use differencing (Xt−Xt-1) to convert a price series into returns, which are often stationary.
modeling for stationary or slightly non-stationary time series
- arima/saria: linear statistical model for short and univariate series (linear, hence only stationary and not non-stationary). saria is an extension of arima integrating seasonality.
- var: multivariate linear statistical model for interconnected time series, meaning if multiple variables influence the series.
- xgboost / lightgbm with feature engineering: classic ml model (boosting), more powerful than arima if well-tuned.
modeling for highly non-stationary time series
- lstm/gru + attention mechanism: dl model for long series, especially for anomaly detection.
- transformers tft (temporal fusion transformers): dl model for long and complex series, used by quant funds.
modeling for non-stationary time series with high uncertainty
- gaussian processes for time series: probabilistic model for series where data is scarce and for small series.
- hidden markov models (hmm): statistical model for series with hidden sequences, meaning when there is an invisible variable influencing a time series (e.g., a crisis market that is not directly observable) and for small series.
- bayesian deep learning: dl model with probabilistic weights.
- neural odes: dl model.
quick summary
- statistical → if the series is stationary and simple (arima).
- probabilistic → if we want to manage uncertainty (hmm, gaussian processes).
- classic machine learning → if we want to boost performance without too much deep learning (xgboost, lightgbm).
- deep learning → if the series is long, nonlinear, and very complex (lstm, transformers).
how to transform time series
1) for stationary series
in general, stationary series do not need transformation since they have constant statistical properties over time (mean, variance, autocorrelation) and are therefore directly usable by machine learning, deep learning, or classical econometric models.
2) for non-stationary series
they must always be transformed before being used.
there are several possible transformations depending on the property that has been identified as non-stationary.
a) non-stationarity due to a non-constant mean (i.e., a trend):
- objective: eliminate a linear trend to make the series stationary.
- transformation solution: simple differencing.
b) non-stationarity due to a non-constant variance (heteroscedasticity):
- objective: stabilize the variance or make it more constant to make the series stationary.
- transformation solution: logarithmic transformation (log transform) or box-cox transformation.
c) non-stationarity due to unstable autocorrelation, i.e., a structural change, a break in the data:
- objective: identify and handle breakpoints to ensure forecast consistency and make the series stationary.
- transformation solution: detection and segmentation of the series using break tests (chow test, cusum) or hidden markov models (hmm).
conclusion:
time series are the dna of financial markets. behind every asset price, every return, every volatility lies a complex dynamic that must be understood, transformed, and modeled to extract value. but, just like in trading, it’s all about structure and adaptation.
if a series is stationary, it is already ready to be exploited by classical models or machine learning algorithms. but as soon as it becomes non-stationary, it rebels: trend, unstable variance, structural shocks… so many traps that can distort forecasts. fortunately, with the right transformations (differencing, logarithms, segmentation ), we can bring it back on track.
Sirine Amrane