← Back to Time Series Forecasting

Lesson 01

Time Series Basics

Financial time series carry temporal structure that cross-sectional data doesn't — autocorrelation, trends, and non-stationarity. Understanding these properties is the first step to building valid forecasting models.

What makes a time series

Most machine learning datasets assume that rows are independent and identically distributed (i.i.d.). You can shuffle the training set, and the model doesn't care. A time series violates this assumption completely: row order encodes information. Yesterday's price directly influences today's; yesterday's volatility predicts tomorrow's.

In financial data, this serial dependency shows up everywhere. Prices trend. Volatility clusters. Spreads widen at the open. These patterns are not noise — they are the signal that forecasting models exploit.

Synthetic price series — geometric Brownian motion (150 bars)
Unlike cross-sectional regression, you CANNOT shuffle the rows. The order is the data. A model trained on shuffled financial time series has seen the future and will fail entirely out of sample.

Autocorrelation — ACF plot

Autocorrelation at lag k measures the correlation between a series and its own past: ACF(k) = Corr(xt, xt-k). For raw prices, ACF decays very slowly — prices are highly correlated with themselves because they trend. For returns, ACF is near zero at almost every lag in efficient markets.

Positive autocorrelation (ACF > 0) indicates momentum: a high return tends to be followed by another high return. Negative autocorrelation (ACF < 0) indicates mean reversion: a high return tends to be followed by a low return. Lag-1 negative ACF in high-frequency data often signals bid-ask bounce.

ACF of log returns — lags 1 to 20. Dashed lines: ±1.96/√n confidence bands.
Returns from an efficient market should show near-zero ACF at all lags. Significant spikes suggest predictability — or bid-ask bounce at lag 1. If you see strong ACF in returns, check whether it survives transaction costs before getting excited.

The lag plot

A lag-1 scatter plot places xt on the x-axis and xt+1 on the y-axis. Each point represents a consecutive pair of observations. If the cloud is elongated along the diagonal, the series has positive autocorrelation. A circular cloud means no autocorrelation. An elongated cloud running anti-diagonal means negative autocorrelation.

Lag-1 scatter: r(t) vs r(t+1) for log returns
Prices show strong positive lag plots (trending). Returns from mature markets show roughly circular clouds — little autocorrelation. If you see a tight diagonal in a return lag plot, either the market is genuinely predictable or there is a data error.

Log returns vs price levels

Raw prices are non-stationary: they drift upward over time, their variance grows, and their distribution changes. Most forecasting models require stationarity. The standard transformation is the log return, which is approximately equal to the percentage return for small moves and has the critical property of being additive across time.

r_t = log(P_t / P_{t-1}) ← log return (stationary)
P_t = P_{t-1} · exp(r_t) ← reconstruct price from returns
Log returns are additive across time: r1→T = r1 + r2 + … + rT. This makes them far more mathematically convenient than raw prices or simple percentage returns, which compound multiplicatively and are harder to sum across periods.