Time Series
Basics
Master the building blocks of trend, seasonality, and decomposition to unlock the stories hidden in data over time.
What Is a Time Series?
A time series is a sequence of data points collected at equally spaced time intervals. Instead of looking at data as a static snapshot, we track how a variable changes over minutes, days, months, or years.
Why Time Series Matters
Businesses rely on time series analysis for forecasting: predicting what comes next. From inventory planning to staffing decisions, understanding temporal patterns is a core analytics skill.
The Four Components
Every time series can be understood as a combination of four underlying components. Recognizing each one is the first step to decomposition.
Visualizing the Components
The Decomposition Model
Decomposition separates a time series into its components so each can be analyzed independently. There are two classical models:
Additive vs Multiplicative
Understanding Trend
The trend component \( T_t \) captures the long-run direction. It filters out short-term noise and reveals whether the series is increasing, decreasing, or flat over time.
Understanding Seasonality
Seasonality \( S_t \) is a fixed, repeating pattern within a known period: daily, weekly, quarterly, or yearly. Unlike cycles, seasonal patterns have a predictable length.
Trend vs Seasonality vs Cycle
| Trend | Seasonality | Cycle | |
|---|---|---|---|
| Direction | Upward, downward, or flat | Oscillates around zero | Oscillates around zero |
| Period | No fixed period | Fixed and known | Variable and unknown |
| Duration | Long-term | Repeats within a fixed, known period | Usually > 1 year |
| Example | GDP growth over decades | Holiday retail spikes | Boom-bust business cycles |
| Predictability | Moderate | High | Low |
How to Decompose a Time Series
Example 1: Reading the Data
A coffee shop tracks monthly sales (in thousands of dollars) over 2 years. Let's identify the components visually.
Example 2: Moving Average
Quarterly revenue data: \( Y = [20, 35, 25, 30, 22, 38, 28, 33] \). Compute a 4-quarter centered moving average for \( T_3 \) through \( T_6 \).
Example 3: Seasonal Indices
Suppose after removing the trend from a quarterly sales dataset, we average the detrended values by quarter to get seasonal indices.
| Quarter | Q1 (Jan-Mar) | Q2 (Apr-Jun) | Q3 (Jul-Sep) | Q4 (Oct-Dec) |
|---|---|---|---|---|
| \( Y_t - T_t \) (Year 1) | \(-1.2\) | \(-2.8\) | \(+3.1\) | \(+0.9\) |
| \( Y_t - T_t \) (Year 2) | \(-1.0\) | \(-3.0\) | \(+3.3\) | \(+0.7\) |
| Seasonal Index \( S_j \) | \(-1.1\) | \(-2.9\) | \(+3.2\) | \(+0.8\) |
The Residual Component
After extracting trend and seasonality, the residual \( R_t \) should look like random noise: no patterns, no trend, centered near zero. If patterns remain, the decomposition is incomplete.
Common Mistakes
Question 1 of 5
In the additive decomposition model, the observed value \( Y_t \) is expressed as:
Question 2 of 5
A retail store's sales show seasonal peaks during the holidays that have been getting larger each year as overall sales grow. Which decomposition model is most appropriate?
Question 3 of 5
What distinguishes seasonality from a cyclical pattern in a time series?
Question 4 of 5
Given quarterly data, you compute a 4-quarter centered moving average. How many observations are lost at each end of the series?
Question 5 of 5
After decomposing a time series, you plot the residuals and notice a clear upward trend. What does this indicate?