Regression: predicting a number
Every month from January to June got warmer. So July will be hotter still… and December? A trend line says 56 °C.
- Draw a trend line through real Srinagar data
- Predict July and measure your error
- Catch the moment a trend stops working
Regression: predicting a number
Every month from January to June got warmer. So July will be hotter still… and December? A trend line says 56 °C.
- Draw a trend line through real Srinagar data
- Predict July and measure your error
- Catch the moment a trend stops working
Story
Learn it
Last lesson's answer was a group (box A, B or C). Today the answer is a number: how hot will July be? Predicting a number from the pattern in past data is called regression. The simplest way is to draw a straight line through the past data, the trend line, and follow it forward. But a trend only works while the pattern holds, and Grandfather is right that the seasons turn.
Words to know
predicting a number (a temperature, a price, marks) from patterns in past data.
the general direction data is moving in: going up, going down, or staying level.
a straight line drawn through the middle of the data points. It is the simplest regression model.
a chart of points, one for each row of data, used to see the trend.
how far a prediction is from the real value: error = prediction − real value. Good models keep it small.
Step by step: predicting a taxi fare
A taxi driver in Srinagar writes down some fares:
| Distance (km) | Fare (₹) |
|---|---|
| 1 | 70 |
| 2 | 90 |
| 3 | 110 |
| 4 | 130 |
- Find the trend: every extra kilometre adds ₹20.
- Draw the trend line through the points. Here they sit exactly on a straight line.
- Follow it forward: for 5 km the line says 130 + 20 = ₹150.
- Check against reality: the real fare for 5 km was ₹155. Error = 150 − 155 = −5, so the prediction was ₹5 too low.
In Calc, the chart's Insert Trend Line → Linear draws the line, and =FORECAST() reads a
prediction off it.
Regression or classification? How many kilos, how much money, how hot: those are numbers, so regression. Which box, spam or not: those are groups, so classification.
Careful: a trend line knows nothing about the world, only the points it was drawn through. Hiba grew 5 cm a year from age 7 to 12; follow that line to age 40 and she would be taller than a door. Always ask: is this still the same pattern?
Your missions
The data
alone or pairs5 min- 1
New Calc file, save as
july-prediction.ods. Headings: A1Month number, B1High (°C). - 2
Type months 1 to 6 in A2:A7 and Srinagar's average highs in B2:B7: 7.7 · 11.1 · 16.6 · 21.3 · 25.5 · 28.9 (Jan–Jun, 1991–2020 averages).
The trend line
5 min- 3
Select A1:B7. Insert → Chart… → XY (Scatter) → Points only → Finish.
- 4
Double-click the chart, right-click a point → Insert Trend Line… → Linear, tick Show equation. This line is your regression model.
Predict, then check
6 min- 5
Predict: July will be ___ °C. Write your guess before the formula.
Only you can see this - 6
In A9 type
7, in B9=FORECAST(A9;B2:B7;A2:A7). The real July high is 30.5 °C. In C9 type=B9-30.5— that's your error. - 7
Now predict December (month 12) the same way. Does the answer make sense? Why not?
No laptop today?
Plot the six points on squared paper (months across, temperature up). Lay a ruler through the middle and draw the line. Read off July and compare with the real 30.5 °C.
Debate it
A company uses regression on past exam marks to predict each student's marks in the final exam, and the school uses the prediction to decide who may sit for science.
Is that fair? What could a student do that the past data could not predict?
Check yourself · practice, not a test
In the app, students answer these one at a time and each answer is checked straight away. It's practice, never a mark — anything they miss comes back later for another go.
1.Regression is used to predict:
- AA group, like "spam"
- BA number, like tomorrow's temperature
- CGroups that have no labels
- DA password
2.A trend line that fits January to June perfectly will also predict December correctly.
TrueFalse3.The model predicted 34 °C and the real value was 30.5 °C. The error is:
- A64.5 °C
- B3.5 °C
- C30.5 °C
- D0 °C
4.Match each question to what it predicts:
- How many kg of apples will this orchard give?
- Is this apple A, B or C grade?
- What will the fruit sell for next week in rupees?
- A group (classification)
- A number (regression)
Regression = using past numbers to predict the next number, and checking how far off we were.
Typing practice
Skill: numbers and the decimal point (7 min)
- On typing.com, do a number row practice lesson.
- Then type these temperatures into a blank sheet, one per cell, pressing Enter after each:
7.7·11.1·16.6·21.3·25.5·28.9 - Use the full-stop key for the decimal point, not a comma.
- 7.7
- 11.1
- 16.6
- 21.3
- 25.5
- 28.9
Written and designed by Faizan Ayoub. © 2026 Faizan Ayoub. All rights reserved.