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.

25 minAdvanced7 graded exercisesFree

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.
y1,y2,…,yTy^T+h ∣ Ty_1, y_2, \ldots, y_T \qquad \hat{y}_{T+h\,|\,T}
Notation used throughout this track
yty_t
the observation at time tt (for example the units ordered in month tt)
TT
the number of observations available, so yTy_T is the most recent one
hh
the forecast horizon: how many periods ahead we forecast
y^T+h ∣ T\hat{y}_{T+h\,|\,T}
the forecast of yT+hy_{T+h} made using data up to time TT only

Dataset

Monthly product demand

288 rows · one row = one product-month · synthetic data

MonthMonth indexProductUnits demanded (units)
2017-01-011Ceiling fan1232
2017-01-011Water heater2430
2017-01-011School backpack1080
2017-02-012Ceiling fan1481
2017-02-012Water heater2264
2017-02-012School backpack429

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.

Line chart of monthly ceiling-fan units: a large summer peak every year, with peaks and troughs both drifting upwards over the eight years.Month indexUnits demanded (units)
Ceiling-fan orders, January 2017 (month 1) to December 2024 (month 96).
Show the data as a table
Month indexUnits demanded
11232
21481
31948
42427
53360
64211
74240
84524
92822
102242
111584
121224
131440
141385
151761
162551
173545
184415
194039
204351
213335
222247
231472
241233
251301
261481
271957
282813
293940
304544
314511
324159
333133
342171
351532
361641
371299
381412
392004
402991
413951
424086
434887
444262
453731
462230
471735
481514
491362
501891
512167
523136
534405
544744
555290
564815
573244
582415
591690
601232
611535
621768
632208
642791
654240
665441
674976
684866
693403
702631
711961
721310
731627
741985
752508
763386
773874
785516
795929
804521
814182
822768
832024
841399
851561
861766
872401
882751
894458
905186
915489
925730
934069
942937
951881
961731

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 recordedRepeating patternPeriod mm
MonthlyCalendar year12
QuarterlyCalendar year4
WeeklyCalendar year52 (approximately)
DailyWeek7 (or 5 for working days only)
Hourly, open 24 hDay24
Frequency and the natural seasonal period

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?

  1. 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.

  2. Year-over-year change compares a period with the same period one cycle earlier: yt−yt−12y_t - y_{t-12} for monthly data.

  3. Annual totals remove the season altogether. From 2017 to 2024 the total rose by 39,960−31,295=8,66539{,}960 - 31{,}295 = 8{,}665 units, a growth of 8,665/31,295=27.7%8{,}665 / 31{,}295 = 27.7\% 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

Not started

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

Not started

Match each series to the natural seasonal period mm (the number of observations in one repeating cycle).

Monthly ceiling-fan orders (yearly pattern)
Quarterly tax receipts (yearly pattern)
Daily contact-centre calls (weekly pattern)
Hourly electricity load of a 24-hour hospital (daily pattern)
Weekly store sales (yearly pattern)

Exercise 3 · Application, difficulty 2 of 3

From hourly records to a daily series

Not started

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

Not started

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?

Not started

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.

No energy reading on 5 days when the meter was offline
No contact-centre rows between 21:00 and 08:00
No fund returns on Fridays and Saturdays
A store's sales system crashed and lost three weeks of sales while the store was open
A month with zero orders for a slow-moving spare part

Exercise 6 · Practice, difficulty 1 of 3

Prepare a series for forecasting

Not started

Put these preparation steps for forecasting water-heater demand from the long-format monthly_demand table in a sensible order.

Put the steps in order (use the arrows)

  1. 1Filter the rows to one product (Water heater)
  2. 2Set aside the most recent months as a test period before fitting any model
  3. 3Sort the rows by month
  4. 4Check the spacing: one row per month, no gaps or duplicates
  5. 5Aggregate to the frequency of the decision if needed (e.g. quarters for quarterly contracts)
  6. 6Plot the series in time order and note trend, seasonality and unusual periods

Exercise 7 · Interpretation, difficulty 2 of 3

A mean that hides the week

Not started

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.

Choose one

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