Class 12 Statistics Notes · GSEB

Method of Least Squares

Time Series — learn how to fit a trend line using coded time values, compute a and b, and forecast future values. GSEB Class 12 Statistics notes.

Last updated: 22 Sep 2026

Notes

Method of Least Squares

Time Series — Chapter 5, GSEB Class 12 Statistics

Fitting a Trend Line

The method of least squares fits a straight trend line through the time series data. We assign natural numbers (t = 1, 2, 3, ...) to the time periods and use the least squares formulas to find the best-fit line.

Trend Line Equation

Y^=a+bt\hat{Y} = a + bt

Slope (b)

b=ntytynt2(t)2b = \frac{n \sum ty - \sum t \sum y}{n \sum t^2 - (\sum t)^2}

Intercept (a)

a=yˉbtˉa = \bar{y} - b\bar{t}
t = time period (natural number: 1, 2, 3, ...), y = observed value, n = number of observations, ȳ = mean of y, = mean of t.

Worked Example

Fit a trend line for the following sales data

YeartSales (y)ty
2017135351
2018240804
20193381149
202044618416
202155025025
202265432436
202375236449
Total3151351140

t̄ = Σt / n = 28 / 7 = 4

ȳ = Σy / n = 315 / 7 = 45.00

b = (nΣty − ΣtΣy) / (nΣt² − (Σt)²) = (7 × 135128 × 315) / (7 × 14028²)

   = (94578820) / (980784) = 3.25

a = ȳ − b·t̄ = 45.003.25 × 4 = 32.00

Ŷ = 32.00 + 3.25t

Forecasting

To forecast future values, assign the next natural number to t and substitute:

Forecast for 2024 and 2025:

2024: t = 8 (next natural number after 7)

Ŷ = 32.00 + 3.25 × 8 = 58.00

2025: t = 9

Ŷ = 32.00 + 3.25 × 9 = 61.25

Remember: t for future years continues the natural number sequence. If data has 7 years (t = 1 to 7), then 2024 gets t = 8, 2025 gets t = 9.

Key Takeaways

Key Takeaways

  • Assign natural numbers to time periods: t = 1, 2, 3, ...
  • b = (nΣty − ΣtΣy) / (nΣt² − (Σt)²) — the slope of the trend line.
  • a = ȳ − b·t̄ — the intercept where the line crosses the Y-axis.
  • Trend line: Ŷ = a + bt — substitute t for any year to forecast.
  • For future years, continue the natural number sequence (t = n+1, n+2, ...).