How many lunches next week?
The canteen cooks lunches before it knows who will come. Too few and pupils go hungry. Too many and food is thrown away.
The cook looks at the last seven weeks and makes a careful guess. That guess is the first step of predicting from data.
Key words
| Word | What it means |
|---|---|
| Pattern | a shape in the data that repeats, such as busy every Friday |
| Trend | the general direction over time: up, down or flat |
| Predictive modelling | using past data to estimate what will probably happen next |
| Prediction | an estimate, not a fact |
| Moving average | the average of the latest few values, which smooths out ups and downs |
| Noise | small random ups and downs that hide the trend |
| Dataset | a collection of records held together for analysis |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can say the difference between a pattern and a trend, explain why we model data to predict, and find a trend in numbers.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Seven weeks of lunch sales
| Week | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|
| Lunches sold | 120 | 131 | 126 | 140 | 149 | 155 | 168 |
The cells students fill in are left blank in this preview.
Pattern or trend?
A pattern repeats. Fridays are always busier. A trend is the overall direction. Over seven weeks, sales are rising, even though week 3 dipped.
You find both by looking at data over time, and by ignoring the small ups and downs.
Try it: a bar chart made of text
sales = [120, 131, 126, 140, 149, 155, 168]
week = 1
for n in sales:
print("Week", week, "#" * (n // 10), n)
week = week + 1
# Each # stands for ten lunches.
# Change a number and run it again.
Real charts
Important
This platform has no charting tool. In a spreadsheet you would draw a line chart with week along the bottom and lunches up the side, then add a trend line. The text bars above show the same shape.
Predicting is a careful guess
Predictive modelling uses past data to estimate the future. The simplest model takes the average step between weeks and adds it to the last value.
It assumes the trend continues. If the school adds a new menu, that may be false. A prediction is never a promise.