Time Series
Beginner 13 min read Time Series

Time Series Fundamentals

Data with memory: order is information

Time-series data is ordered, dependent and often trending. Stationarity, components (trend, seasonality, noise) and the forecasting setup decide which models could work — everything else follows.

time seriesstationaritytrendseasonalityautocorrelationforecasting
Prerequisites: Statistics
Before we start

What you will learn

  • Describe trend, seasonality and residual components
  • Explain stationarity and why models assume it
  • Frame a forecasting problem (horizon, frequency, as-of date)
Introduction

What is this?

A time series is a sequence of observations indexed by time — daily revenue, hourly CPU, weekly inventory. Unlike tabular rows, these points are ordered and dependent: tomorrow's value correlates with today's. Time-series modeling decomposes the signal into trend (long-duration drift), seasonality (periodic cycles) and residual noise, then extrapolates that structure to future horizons. Whether inference (regression-style) or extrapolation (forecasting) is the goal changes every modeling decision.

Motivation

Why do you need it?

  • Ordering means standard i.i.d. assumptions are wrong — shuffling corrupts the signal.
  • Trend and seasonality are modelable structure that naive methods ignore.
  • Stationarity determines which statistical machinery (ARIMA, spectral, etc.) is even applicable.
  • Choosing the wrong setup (horizon, forecast vs nowcast) silently invalidates results.
Think about it

Mental model

Imagine

A trail of footprints in snow

Think of

A time series

Each footprint (observation) says something about the one before and after — direction, stride, momentum. You can't 'shuffle' a trail and still read where it goes. Time series reading is about extrapolating from a pattern, not comparing independent samples.

Mechanics

How it works

  • Establish the sampling frequency, horizon (h steps ahead) and the exact prediction-time view.
  • Plot and split components: moving-average trend, seasonal effect by period, and residuals.
  • Check stationarity (constant mean/variance over time) with the Augmented Dickey-Fuller test or visual inspection.
  • Estimate autocorrelation (ACF/PACF) to see which lags carry signal.
  • Choose modeling family by the components: trend/seasonal → decomposition+exponential/ARIMA; rich calendar features → ML.

From raw series to component-wise forecast.

Raw series
Decompose
Model components
Extrapolate
Validate
Real world

In production

  • An e-commerce planner forecasts daily sales with a weekly seasonality at a 14-day horizon to set inventory buffers.
  • An SRE team forecasts error-spike days by decomposing hourly 5xx count into weekly traffic cycles plus incident noise.
  • A demand-sensing team retrains nightly so the seasonal effects always reflect last month's calendar.
Guidelines

Best practices

  • Pin the horizon and frequency up front; forecast targets drift if either changes.
  • Validate on future-only windows (walk-forward), never shuffled folds.
  • Inspect ACF/PACF before choosing a model family — the lags say which dependency structure is real.
  • Always compare against the best trivial baseline (last value, seasonal naive).
Watch out

Common mistakes

  • Ignoring the calendar (holidays, weekends) treated as uniform seasonality.
  • Fitting models on raw trending data without differencing, then complaining about non-stationarity.
  • Predicting far-future levels with a 'nowcast' model trained on short memory.
  • Holding out a random test slice instead of the most recent — leaks future into training windows.
Root cause analysis

Common issues

Error
Very high training fit, embarrassing forecast
Root cause

Model captured noise/lagged signal instead of structure

Fix

Backtest honestly out-of-sample, difference non-stationary terms, and shrink the model's lag memory.

Error
Forecast repeats last period flatly
Root cause

Seasonality period mis-specified or trend dominated by one event

Fix

Decompose and confirm the seasonal period; add explicit calendar features.

When things break

Debugging tips

  • Plot residuals vs fitted and vs time: a pattern in the residual line = missing component or decree.
  • If ACF decays slowly at large lags, the series is trending — difference it and re-inspect.
  • Forecast too smooth? Your model overdamps seasonality; verify the seasonal period matches the data.
  • Two-step: fix the horizon and 'as-of' timestamp, then rerun — the test setup is usually the bug, not the model.
Interviews

Interview checkpoint

Test yourself

Quick quiz

0/2
1

The correct way to split time-series data for validation is:

2

Trend and seasonality are structure that can often be modeled and extrapolated.

Go deeper

Official documentation