HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Time Series and Moving Averages
  1. 1Time series graphs and moving averages
  2. 2Centred moving averages and the trend line
  3. 3Seasonal components and forecasts
  1. Statistics & Data Science
  2. /Time Series and Moving Averages
  3. /Time series graphs and moving averages

Course 7.3·Lesson 1 of 3

Time series graphs and moving averages

A school library lends more books in autumn than in summer, every year. Is it lending more books year by year? A time series graph shows the ups and downs. A moving average smooths them away, so that the long-term direction can be seen.

about 25 min1 simulation1 practice question
Lesson 1 of 3Show all lessonsHide
Time Series and Moving Averages
  1. 1Time series graphs and moving averages
  2. 2Centred moving averages and the trend line
  3. 3Seasonal components and forecasts

Try the code and the simulations beside the lesson.

What you will be able to do

  • plot a time series graph and describe its trend, its seasonal variation and its random variation;
  • explain why we find moving averages, and choose how many points to use;
  • calculate a moving average with an odd number of points, and plot it at the right time.

Books borrowed, term by term

A school year has three terms: autumn, spring and summer. A made-up school library counts the books borrowed in each term for three years.

  • Year 1: 420, 350, 280.
  • Year 2: 480, 380, 340.
  • Year 3: 510, 440, 370.

A set of values recorded at regular intervals of time is a time series.

The time series graph

To plot a time series graph:

  1. Put time on the horizontal axis, in order, at equal steps. Here the terms are numbered 1 to 9.
  2. Put the value on the vertical axis.
  3. Plot each value, then join the points with straight lines in order. The lines help the eye. They do not mean that a value between two terms is known.
Time series graph of books borrowed from a school library in nine terms over three years: 420, 350, 280, 480, 380, 340, 510, 440 and 370, joined by straight lines. Square markers joined by a dashed line show the 3-point moving averages 350, 370, 380, 400, 410, 430 and 440, plotted at terms 2 to 8.

Three things a time series can show

  • Trend: the general direction over a long time. Here the loans go up from year to year.
  • Seasonal variation: a pattern that repeats over a fixed period. Here autumn is always the highest term and summer the lowest. "Seasonal" does not need weather. Any repeating cycle counts: terms, days of the week, quarters, months.
  • Random variation: the irregular bits that follow no pattern, such as a week of illness or a fire drill.

Why moving averages?

The seasonal swing hides the trend. Is spring of year 2 higher than autumn of year 1? No, but that tells us nothing. We should compare whole years, not one term with another.

A moving average takes the mean of a run of values, then moves on by one value and takes the mean again. If each run holds one full cycle, every average contains each season once. The seasonal ups and downs cancel out, and random bits are smoothed too. What is left shows the trend.

The number of points is the length of one cycle.

  • Three terms a year: a 3-point moving average.
  • Days of the week, open every day: a 7-point moving average.
  • Quarters of a year: a 4-point moving average.
  • Months of a year: a 12-point moving average.

Calculating a 3-point moving average

  1. The first run. Terms 1, 2 and 3: 420+350+2803=350\dfrac{420 + 350 + 280}{3} = 3503420+350+280​=350.
  2. Move on one term. Terms 2, 3 and 4: 350+280+4803=370\dfrac{350 + 280 + 480}{3} = 3703350+280+480​=370.
  3. Keep going to the end of the data.

The seven moving averages are 350, 370, 380, 400, 410, 430 and 440.

Each average is plotted at the middle of its run. The first belongs to term 2, the second to term 3, and so on. Nine values give only seven averages: there is no average for the first or the last term.

The averages rise steadily, from 350 to 440. The library really is lending more books.

Practise with new numbers

Try it in Python

The program works out the 3-point moving averages of the library loans and draws them on the time series graph.

Predict first. Will the moving averages go up and down like the loans, or rise steadily? Then run it and check with Show the answer.

Your turn.

Now change the program.

1. Change the summer loan of year 3 from 370 to 470. Which moving averages change, and why only those?

2. Try a 2-point moving average, by averaging loans[k] and loans[k + 1] only. Does the seasonal swing disappear?

The usual mistakes

  • Using the wrong number of points. The run must cover exactly one cycle. A 2-point average of termly data still swings.
  • Plotting an average at the end of its run. It belongs to the middle.
  • Joining the moving averages to the first data point. There is no average for the first term.
  • Reading the trend from two single values. Compare the moving averages, not one term with another.

Remember these

  • A time series is a set of values at regular times, plotted against time.
  • Trend, seasonal variation and random variation are the three parts to look for.
  • A moving average over one full cycle removes the seasonal swing and shows the trend.
  • An odd-point moving average is plotted at the middle value of its run.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. Name the three kinds of movement a time series can show.
  1. A shop is open every day of the week and records its takings each day. How many points should its moving average use?
  1. Find the 3-point moving average of 64, 52 and 46.
  1. Twelve monthly values are given. How many 3-point moving averages can be found?
  1. Why does a 3-point moving average remove the seasonal swing from termly data?

Enroll free in Time Series and Moving Averages

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (3)

A school canteen counts the lunches it sells on each of the five school days, for two weeks…Easy · High School (9–10) · by StemPy Lab
A youth club records its members in each of three terms a year…Easy · High School (9–10) · by StemPy Lab
A made-up hotel splits its year into three seasons: low, high and middle…Medium · High School (9–10) · by StemPy Lab
Next: lesson 2Centred moving averages and the trend line
← Time Series and Moving Averages
← PreviousCentred moving averages and the trend line →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
6 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

Python Labs (1)

Moving averages of any lengthPython Lab · by StemPy Lab