Time series analysis is the statistical framework for modeling sequential data indexed by time, where observations are correlated with their past values and exhibit temporal dependencies that standard cross-sectional methods cannot capture. It's essential for forecasting economic indicators, predicting stock prices, monitoring sensor data, and understanding phenomena where order matters — from daily temperatures to quarterly sales. The key mental model: a time series is not random samples but a structured sequence where today's value carries information about tomorrow, and understanding this temporal structure through decomposition, stationarity testing, and model identification is the foundation for accurate prediction.
What This Cheat Sheet Covers
This topic spans 22 focused tables and 94 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Stationarity Tests
Most time series models assume the data is stationary — its statistical properties don't drift over time — so checking that assumption is step one. The subtle trap is that ADF and KPSS flip their null hypotheses, which is exactly why practitioners run both: agreement gives you confidence, disagreement flags a series that needs a closer look.
| Test | Example | Description |
|---|---|---|
from statsmodels.tsa.stattools import adfullerresult = adfuller(ts)p_value = result[1] | • Tests null hypothesis of unit root (non-stationarity) using autoregressive model with trend • p < 0.05 rejects null and suggests stationarity | |
from statsmodels.tsa.stattools import kpssstatistic, p_value = kpss(ts, regression='c') | • Null hypothesis is stationarity (complementary to ADF) • p < 0.05 indicates non-stationarity • use both tests for confirmation |