Trend lines and forecasting
Use trend lines to look ahead in Year 12 VCE General Mathematics. Councils planning school places in Melbourne's growing west and tourism operators in Mildura budgeting for next summer all need a sensible forecast, and a least squares line through a time series gives one: \(y = a + bt\), where \(t\) counts the time periods.
You will practise numbering time periods, fitting the line with technology, interpreting the slope as the average change per period, and making forecasts. For seasonal data you will fit the line to deseasonalised values and then multiply by the seasonal index, and you will learn why a forecast far into the future can go badly wrong.
Theory
A least squares trend line \(y = a + bt\) models the long-term direction of a time series. This Year 12 General Mathematics guide for students in Victoria shows how to fit it with technology, interpret the slope and intercept, make forecasts (re-seasonalising seasonal data) and recognise the limits of extrapolating.
To model the long-term trend in a time series, number the time periods \(t = 1, 2, 3, \ldots\) in order and fit a least squares line in which time \(t\) is the explanatory variable and the data value is the response variable. Always state what \(t = 1\) stands for (for example, \(t = 1\) is Q1 \(2023\)).
The trend line is written \(y = a + bt\). The slope \(b\) is the average change in the data per time period, and the intercept \(a\) is the value the line gives at \(t = 0\), the period just before the data start. Find \(a\) and \(b\) with technology, entering \(t\) as the explanatory variable.
A forecast is made by substituting a future value of \(t\). If the data are seasonal, first deseasonalise them, fit the line to the deseasonalised values, forecast, and then re-seasonalise by multiplying by the seasonal index. Forecasting beyond the data is extrapolation: it assumes the linear trend continues, so it is only reliable a short way ahead.
The least squares trend line, with time period \(t\) as the explanatory variable:
What the calculator works out (\(\bar{t}\), \(\bar{y}\) are the means, \(s_t\), \(s_y\) the standard deviations and \(r\) the correlation coefficient):
Forecasting seasonal data from a trend line fitted to the deseasonalised values:
Finding \(t\) for a future period (\(t = 1\) is the first period):
| Data | \(t\) for the period |
|---|---|
| yearly, \(t = 1\) is year \(Y_1\) | year \(- Y_1 + 1\) |
| quarterly, \(t = 1\) is Q1 of year \(Y_1\) | \(4 \times (\text{year} - Y_1) + \text{quarter number}\) |
| monthly, \(t = 1\) is January of year \(Y_1\) | \(12 \times (\text{year} - Y_1) + \text{month number}\) |
Fitting and using a trend line
- Number the periods \(t = 1, 2, 3, \ldots\) and say what \(t = 1\) is.
- Remove the season if needed. For seasonal data, deseasonalise first: actual \(\div\) seasonal index.
- Fit the line with technology, \(t\) as the explanatory variable. Write \(y = a + bt\) in words for the context, with \(a\) and \(b\) usually to \(2\) decimal places.
- Interpret: the slope is the average change per period; the intercept is the trend value at \(t = 0\).
- Forecast: find \(t\) for the future period and substitute. For seasonal data, multiply the result by that season's index (re-seasonalise).
- Judge the limitations: a forecast is more trustworthy when the points follow a straight line closely, the forecast is only a short way past the data, and nothing suggests the trend will change. A forecast far ahead can even give an impossible value.
Find the value of \(t\) for \(2027\), then substitute.
(i) On average, the number of students increases by \(12.5\) each year. (ii) At \(t = 0\) (\(2018\)) the trend line gives \(386\) students.
| \(t\) | \(=\) | \(2027 - 2019 + 1\) |
| \(t\) | \(=\) | \(9\) |
| \(\text{students}\) | \(=\) | \(386 + 12.5 \times 9\) |
| \(\text{students}\) | \(=\) | \(386 + 112.5\) |
| \(\text{students}\) | \(=\) | \(498.5\) |
(iii) About \(499\) students in \(2027\) (the model gives \(498.5\)).
Number the years from \(2018\), substitute, then compare each \(t\) with the data (\(t = 1\) to \(7\)).
| \(2026\) | \(:\) | \(t = 2026 - 2018 + 1 = 9\) |
| \(\text{cheques}\) | \(=\) | \(52.4 - 4.6 \times 9\) |
| \(\text{cheques}\) | \(=\) | \(52.4 - 41.4\) |
| \(\text{cheques}\) | \(=\) | \(11\) |
| \(2032\) | \(:\) | \(t = 2032 - 2018 + 1 = 15\) |
| \(\text{cheques}\) | \(=\) | \(52.4 - 4.6 \times 15\) |
| \(\text{cheques}\) | \(=\) | \(52.4 - 69\) |
| \(\text{cheques}\) | \(=\) | \(-16.6\) |
(i) \(11\) million. (ii) \(-16.6\) million. (iii) The \(2026\) forecast is only two years past the data, so it is reasonable if the trend continues. The \(2032\) forecast is impossible (a negative number of cheques): it is far beyond the data, and a linear decrease cannot continue forever.
| Year | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 |
|---|---|---|---|---|---|---|
| \(t\) | 1 | 2 | 3 | 4 | 5 | 6 |
| Installations (hundreds) | 24 | 27 | 31 | 32 | 36 | 40 |
Enter \(t\) as the explanatory variable and the installations as the response variable. The calculator does the following:
| \(S_{tt}\) | \(=\) | \(17.5\) |
| \(S_{ty}\) | \(=\) | \(54\) |
| \(b\) | \(=\) | \(\dfrac{54}{17.5}\) |
| \(b\) | \(\approx\) | \(3.085714\) |
| \(a\) | \(=\) | \(\bar{y} - b\bar{t}\) |
| \(a\) | \(\approx\) | \(31.666667 - 3.085714 \times 3.5\) |
| \(a\) | \(\approx\) | \(20.8667\) |
| \(2026\) | \(:\) | \(t = 2026 - 2019 + 1 = 8\) |
| \(\text{installations}\) | \(=\) | \(20.87 + 3.09 \times 8\) |
| \(\text{installations}\) | \(\approx\) | \(45.6\) |
(i) \(\text{installations} = 20.87 + 3.09 \times t\). (ii) On average, installations increase by \(3.09\) hundred (about \(309\)) each year. (iii) About \(45.6\) hundred in \(2026\), two years past the data, with a strong linear pattern (\(r \approx 0.99\)).
| Year | Q1 | Q2 | Q3 | Q4 |
|---|---|---|---|---|
| 2024 | 240 | 189 | 184 | 253 |
| 2025 | 300 | 234 | 216 | 319 |
| Seasonal index | 1.20 | 0.90 | 0.80 | 1.10 |
Divide by the indices, fit the line to the deseasonalised values, forecast for the right \(t\), then multiply by the Q1 index.
| \(\text{Q1}\) | \(:\) | \(\tfrac{240}{1.20} = 200,\ \ \tfrac{300}{1.20} = 250\) |
| \(\text{Q2}\) | \(:\) | \(\tfrac{189}{0.90} = 210,\ \ \tfrac{234}{0.90} = 260\) |
| \(\text{Q3}\) | \(:\) | \(\tfrac{184}{0.80} = 230,\ \ \tfrac{216}{0.80} = 270\) |
| \(\text{Q4}\) | \(:\) | \(\tfrac{253}{1.10} = 230,\ \ \tfrac{319}{1.10} = 290\) |
| \(S_{tt}\) | \(=\) | \(42\) |
| \(S_{ty}\) | \(=\) | \(520\) |
| \(b\) | \(=\) | \(\dfrac{520}{42} \approx 12.380952\) |
| \(a\) | \(\approx\) | \(242.5 - 12.380952 \times 4.5 \approx 186.7857\) |
| \(\text{Q1 2026}\) | \(:\) | \(t = 4 \times 2 + 1 = 9\) |
| \(\text{deseasonalised}\) | \(=\) | \(186.79 + 12.38 \times 9\) |
| \(\text{deseasonalised}\) | \(=\) | \(298.21\) |
| \(\text{forecast}\) | \(=\) | \(298.21 \times 1.20\) |
| \(\text{forecast}\) | \(\approx\) | \(357.9\) |
(i) Deseasonalised: \(200,\ 210,\ 230,\ 230,\ 250,\ 260,\ 270,\ 290\). (ii) \(\text{deseasonalised bookings} = 186.79 + 12.38 \times t\). (iii) About \(357.9\) bookings in Q1 \(2026\). Q1 is a busy quarter (index \(1.20\)), so the forecast is above the trend value.
Common pitfalls
Frequently asked questions
What is the explanatory variable when fitting a trend line to a time series?
Time is the explanatory variable. The periods are numbered t = 1, 2, 3 and so on, and the data value is the response variable. The line is written y = a + bt.
How do I interpret the slope of a trend line?
The slope b is the average change in the data for each time period. For example, a slope of 12.5 with yearly data means the value increases by 12.5 each year on average. A negative slope means a decreasing trend.
How do I forecast with a trend line?
Work out the value of t for the future period, substitute it into y = a + bt and calculate y. If the line was fitted to deseasonalised data, multiply the result by the seasonal index for that season.
Why do I deseasonalise before fitting a trend line?
Seasonal ups and downs make the points zig-zag, which can pull the least squares line about. Deseasonalised values show the underlying trend, so the line models the long-term direction better.
What are the limitations of forecasting with a trend line?
The forecast assumes the trend stays linear and nothing changes. It is less reliable the further it goes beyond the data, and a long-range forecast can give impossible values, such as a negative number.
What does the intercept of a trend line mean?
It is the trend value at t = 0, the time period just before the first data value. It often has little practical meaning, but it fixes where the line starts.