Time Series
Also known as: temporal data, series data.
Observations of one quantity recorded in time order. Neighbouring values are related and order matters, so time series need methods that respect time.
Synthetic dataExamples on this page use synthetic data created for illustration.
Definition
A time series is a set of observations of the same quantity recorded in time order, usually at regular intervals. Because neighbouring values are related and order matters, time series need methods and validation that respect time rather than treating observations as shuffled, independent samples.
In plain terms
Prices, ratings counts, ranks and traffic are all recorded over time. Such data typically contain a trend (a slow direction), seasonality (a repeating pattern) and noise. Today’s value is usually closer to yesterday’s than to a random day’s, which breaks the independence assumed by many basic statistical methods.
Consequences: do not shuffle the observations; split data by time, not at random (Walk-forward Validation); record gaps as gaps, not zeros; and take care with the time of each observation (UTC and Time Zones).
Example
Eight weekly values of a rating count: 100, 104, 103, 110, 115, 113, 120, 125.
| Version | What the data show |
|---|---|
| In time order | A steady climb of about 3% a week |
| Shuffled | The same mean (111) but the direction is gone; it could be anything |
Any method that shuffles the weeks, such as a random train/test split, throws away the very pattern the series contains and, worse, lets the model peek at the future of the weeks it predicts.
Common misunderstandings
- “A time series is just a table sorted by date.” The ordering is the information; methods must respect it.
- “A random train/test split is fine.” It leaks the future into the past; split by time.
- “Missing days can be ignored or filled with zero.” A missing day is missing; zero is a measurement.
References
- Rob J. Hyndman, George Athanasopoulos. Forecasting: Principles and Practice . OTexts, 2021.
- George E. P. Box, Gwilym M. Jenkins, Gregory C. Reinsel, Greta M. Ljung. Time Series Analysis: Forecasting and Control . Wiley, 2015. ISBN 978-1118675021.