Applied Mathematics · Ch 8 — Index Numbers and Time-based Data
Computation of Straight-line Trend by Using Method of Least Squares
Computation of Straight-line Trend by Using Method of Least Squares
The method of least squares fits the mathematically best-possible straight line to a time series — "best" in the specific sense that it minimises the total squared distance between the actual values and the values the line predicts, which also removes personal bias from drawing the trend by hand. A straight trend line takes the familiar form
where is the actual (observed) value, represents time, and , are constants to be found. The number of observations used to fit the line can be odd or even.
The "least squares" in the name comes from two conditions that together define the best-fit line: the sum of the deviations between actual values and estimated values must be zero, and — more importantly — the sum of the squares of those deviations must be as small as possible, i.e. is minimised. Solving this minimisation leads to two normal equations that pin down and :
These two equations can be solved directly, but there is a standard shortcut: since time is measured in uniform successive steps, taking the middle time period as the origin (so falls at the centre of the series) makes . Substituting this into the normal equations collapses them to:
…