# Mathematical Curve Fitting

Mathematical curve fitting is probably the most objective method of isolating trends. This method enables us to obtain precise estimates of the trend values based on some objective criteria. One of the major problems in using this method is the selection of an appropriate type of curve which best fits the given data. However, experience and value judgment is the best guide to select a suitable curve. A scatter diagram provides clues in this respect.

The scope of our tutorials restricts us to the discussion of fitting polynomials. Generally, first or second degree polynomials are sufficient enough to represent most economic data. Moreover, certain other mathematical forms may also fit the given data by applying a linear transformation to such functions.

__Fitting a Straight Line Trend__

The method of fitting a first degree polynomial or a straight line is almost identical to fitting a regression line of $$Y$$ on $$X$$, which was already discussed in our earlier tutorials. The equation of the line is obtained by employing the principal of least squares, explained sufficiently in previous tutorials. In the present context the observations on the time series represent the dependent variable $$Y$$, while the time, denoted by $$X$$, represents the independent variable. As a modification or simplification we may convert the years, quarters or months into time codes around some arbitrary origin. Any time period may serve as the origin, however if the middle most period is chosen as the origin the estimation of the perimeter of the line become extremely simple, as the sum of the coded time variable may be made zero and the normal equations of regressions reduces to $$\sum Y = na$$ and $$\sum XY = b\sum {X^2}$$.

Upon further simplification this yields the formulae for estimating $$a$$ and $$b$$, as

\[\begin{gathered} a = \frac{{\sum Y}}{n} = \overline Y \\ b = \frac{{\sum XY}}{{\sum {X^2}}} \\ \end{gathered} \]

Here $$a$$ and $$b$$ are the estimates of coefficients of the trend line $$Y = a + bX$$.

If the data consist of an odd number of time periods the subtraction of the middle most period yields coded time values **…, -3, -2, -1, 0, 1, 2, 3, …** whose sum is zero. If the number of observations is even, it is difficult to center the origin on a particular time period. However, if we code the time variable in half units, e.g. half year, half quarter etc., then we obtain the coded time values as **…, -5, -3, -1, 0, 1, 3, 7, …** whose sum is also zero. It should be noted that difference origin yields a different set of coefficients, however the trend values obtained from them are identical. After having found the trend, the trend values may be estimated by substituting the coded time values into the equation of the trend.