Track 12 · Time Series and Forecasting · Lesson 1 of 11
Time-indexed data
Recognise what makes data a time series, prepare a single regular series from raw records, and describe change over time correctly.
A distributor must decide how many ceiling fans to order for next summer. Last year's orders, month by month, are the most useful evidence it has — but only if they are kept in time order, at a sensible frequency, with gaps noticed and the right months compared with each other.
A time series is a sequence of measurements of the same quantity taken at successive, usually equally spaced, points in time: monthly units ordered, weekly sales, daily electricity use, hourly calls.
Two things set it apart from the data in earlier tracks:
- Order carries information. Shuffle the rows of a survey and nothing is lost. Shuffle a time series and the trend, the seasons and the link between this month and last month all disappear.
- Observations are not independent. A hot week is usually followed by another warm week; a busy Sunday at a contact centre is followed by the next busy Sunday. Methods that assume independent observations (most of Track 8) do not apply directly.
- the observation at time (for example the units ordered in month )
- the number of observations available, so is the most recent one
- the forecast horizon: how many periods ahead we forecast
- the forecast of made using data up to time only
Dataset
Monthly product demand
288 rows · one row = one product-month · synthetic data
| Month | Month index | Product | Units demanded (units) |
|---|---|---|---|
| 2017-01-01 | 1 | Ceiling fan | 1232 |
| 2017-01-01 | 1 | Water heater | 2430 |
| 2017-01-01 | 1 | School backpack | 1080 |
| 2017-02-01 | 2 | Ceiling fan | 1481 |
| 2017-02-01 | 2 | Water heater | 2264 |
| 2017-02-01 | 2 | School backpack | 429 |
Long format: one row per product-month. Three products share the same month, so you must filter to one product before treating the column units as a series.
Show the data as a table
| Month index | Units demanded |
|---|---|
| 1 | 1232 |
| 2 | 1481 |
| 3 | 1948 |
| 4 | 2427 |
| 5 | 3360 |
| 6 | 4211 |
| 7 | 4240 |
| 8 | 4524 |
| 9 | 2822 |
| 10 | 2242 |
| 11 | 1584 |
| 12 | 1224 |
| 13 | 1440 |
| 14 | 1385 |
| 15 | 1761 |
| 16 | 2551 |
| 17 | 3545 |
| 18 | 4415 |
| 19 | 4039 |
| 20 | 4351 |
| 21 | 3335 |
| 22 | 2247 |
| 23 | 1472 |
| 24 | 1233 |
| 25 | 1301 |
| 26 | 1481 |
| 27 | 1957 |
| 28 | 2813 |
| 29 | 3940 |
| 30 | 4544 |
| 31 | 4511 |
| 32 | 4159 |
| 33 | 3133 |
| 34 | 2171 |
| 35 | 1532 |
| 36 | 1641 |
| 37 | 1299 |
| 38 | 1412 |
| 39 | 2004 |
| 40 | 2991 |
| 41 | 3951 |
| 42 | 4086 |
| 43 | 4887 |
| 44 | 4262 |
| 45 | 3731 |
| 46 | 2230 |
| 47 | 1735 |
| 48 | 1514 |
| 49 | 1362 |
| 50 | 1891 |
| 51 | 2167 |
| 52 | 3136 |
| 53 | 4405 |
| 54 | 4744 |
| 55 | 5290 |
| 56 | 4815 |
| 57 | 3244 |
| 58 | 2415 |
| 59 | 1690 |
| 60 | 1232 |
| 61 | 1535 |
| 62 | 1768 |
| 63 | 2208 |
| 64 | 2791 |
| 65 | 4240 |
| 66 | 5441 |
| 67 | 4976 |
| 68 | 4866 |
| 69 | 3403 |
| 70 | 2631 |
| 71 | 1961 |
| 72 | 1310 |
| 73 | 1627 |
| 74 | 1985 |
| 75 | 2508 |
| 76 | 3386 |
| 77 | 3874 |
| 78 | 5516 |
| 79 | 5929 |
| 80 | 4521 |
| 81 | 4182 |
| 82 | 2768 |
| 83 | 2024 |
| 84 | 1399 |
| 85 | 1561 |
| 86 | 1766 |
| 87 | 2401 |
| 88 | 2751 |
| 89 | 4458 |
| 90 | 5186 |
| 91 | 5489 |
| 92 | 5730 |
| 93 | 4069 |
| 94 | 2937 |
| 95 | 1881 |
| 96 | 1731 |
In this (synthetic) dataset the yearly ceiling-fan total grows from 31,295 units in 2017 to 39,960 in 2024, and every year has a summer peak. A line chart in time order shows both features at a glance; a histogram of the same 96 numbers would hide them completely.
| Data recorded | Repeating pattern | Period |
|---|---|---|
| Monthly | Calendar year | 12 |
| Quarterly | Calendar year | 4 |
| Weekly | Calendar year | 52 (approximately) |
| Daily | Week | 7 (or 5 for working days only) |
| Hourly, open 24 h | Day | 24 |
Frequency is a choice. The contact-centre data are recorded per hour (13 opening hours a day), but staffing rotas are planned per day. Summing the hours of each date gives a daily series of 90 values with a mean of 278 calls. Choose the frequency at which the decision is made, and aggregate with the right operation: sum for flows (calls, units, kWh), mean or last value for levels (temperature, price, stock on hand).
Worked example
Comparing like with like
Ceiling-fan orders were 31,295 units in 2017 and 39,960 in 2024. A manager also notices that December 2024 is far below July 2024 and asks whether demand is collapsing. How should the change be described?
Seasonal data must be compared with the same season. December is always a low month for fans, so December vs July mostly measures the season, not a change in demand.
Year-over-year change compares a period with the same period one cycle earlier: for monthly data.
Annual totals remove the season altogether. From 2017 to 2024 the total rose by units, a growth of over seven years.
Demand is not collapsing: the December dip is seasonal. Over the whole period demand grew by about 28%.
Quick check
You randomly split 96 months of orders into 80% training rows and 20% test rows to evaluate a forecasting method. What is wrong?
Exercises
The lesson is complete when every exercise is answered correctly. Hints are free; viewing a worked solution before solving means the exercise won't count towards mastery.
0 of 7 exercises correct (not saved — sign in to keep your progress)
Exercise 1 · Guided, difficulty 1 of 3
Year-over-year growth from monthly records
Using the monthly_demand data for Ceiling fan only, add up the units for 2023 (months 73–84) and for 2024 (months 85–96). Then give the year-over-year percentage change from 2023 to 2024, to 2 decimal places.
Data: monthly_demand (product = Ceiling fan) · Open in the lab to explore and calculate.
Exercise 2 · Practice, difficulty 1 of 3
Match the frequency to its seasonal period
Match each series to the natural seasonal period (the number of observations in one repeating cycle).
Exercise 3 · Application, difficulty 2 of 3
From hourly records to a daily series
The call_center data have one row per opening hour (13 per day). Staff rotas are planned per day, so build the daily series: the total calls_offered on each date.
Give the total for the first date (2024-01-07) and the mean daily total over all 90 days (2 decimal places).
Data: call_center · Open in the lab to explore and calculate.
Exercise 4 · Practice, difficulty 2 of 3
Compare the right quarters
Quarterly sales of a product (units) for three years, oldest first (Q1, Q2, Q3, Q4 of year 1, then year 2, then year 3):
176, 214, 277, 214, 192, 251, 306, 227, 218, 261, 334, 250
The sales director wants to know how the latest quarter (Q4 of year 3) compares with a year earlier. Give the change in units and the percentage change (2 decimal places).
Exercise 5 · Interpretation, difficulty 2 of 3
Missing, or simply not part of the calendar?
For each situation, decide whether the absent values are missing data that must be handled, or an absence by design that defines the calendar of the series.
Exercise 6 · Practice, difficulty 1 of 3
Prepare a series for forecasting
Put these preparation steps for forecasting water-heater demand from the long-format monthly_demand table in a sensible order.
Exercise 7 · Interpretation, difficulty 2 of 3
A mean that hides the week
The mean daily total of calls is 278.0. A planner proposes staffing every day for that number. Which statement best describes the problem?
Data: call_center · Open in the lab to explore and calculate.
What you can now do
- Explain why order and dependence make time series different from independent observations
- Build a single regular series from long-format or hourly records, aggregating flows by summing
- Choose the seasonal period that matches the frequency
- Compare seasonal data with the same season a cycle earlier, or with annual totals
- Distinguish missing values from absences that define the calendar