# Mathematical Curve Fitting

Mathematical curve fitting is probably the most objective method of isolating trend. This method enables us to obtain precise estimates of the trend values based on some objective criterion. One of the major problems in using this method is the selection of an appropriate type of curve which best fit to the given data. However, experience and value judgment is the best guide to select a suitable type. Scatter diagram provides the clue 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 represents most economic data. Moreover, certain other mathematical forms may also fit to 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$, already discussed in our earlier tutorials. The equation of the line is obtained by employing the principal of least squares, explained sufficiently enough 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 origin, however, if the middle most period is chosen as origin the estimation of the perimeter of the line become extremely simple, for, the sum of 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}$.

Which on further simplification yield the formulae for estimating $a$  and $b$, as

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

If the data consists of odd number of time periods the subtraction of the middle most period would yield coded time values …, -3, -2, -1, 0, 1, 2, 3, … whose sum is zero. If the numbers of observations are even, it would be 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 would obtain the coded time values as …, -5, -3, -1, 0, 1, 3, 7, … whose sum would also be zero. This may be noted that difference origin would yield different set of coefficients; however, the trend values obtained from them would be identical. After having found the trend, the trend values may be estimated by substituting the coded time values into the equation of the trend.