Linear trend estimation is a statistical technique used to analyze data patterns. Data patterns, or trends, occur when the information gathered tends to increase or decrease over time or is influenced by changes in an external factor. Linear trend estimation essentially creates a straight line on a graph of data that models the general direction that the data is heading.
Fitting a trend: Least-squares Given a set of data, there are a variety of functions that can be chosen to fit the data. The simplest function is a straight line with the dependent variable (typically the measured data) on the vertical axis and the independent variable (often time) on the horizontal axis. The least-squares fit is a common method to fit a straight line through the data. This method minimizes the sum of the squared errors in the data series y {\displaystyle y} . Given a set of points in time t {\displaystyle t} and data values y t {\displaystyle y_{t}} observed for those points in time, values of a ^ {\displaystyle {\hat {a}}} and b ^ {\displaystyle {\hat {b}}} are chosen to minimize the sum of squared errors
∑ t [ y t − ( a ^ t + b ^ ) ] 2 {\displaystyle \sum _{t}\left[y_{t}-\left({\hat {a}}t+{\hat {b}}\right)\right]^{2}} . This formula first calculates the difference between the observed data y t {\displaystyle y_{t}} and the estimate ( a ^ t + b ^ ) {\displaystyle ({\hat {a}}t+{\hat {b}})} , the difference at each data point is squared, and then added together, giving the "sum of squares" measurement of error. The values of a ^ {\displaystyle {\hat {a}}} and b ^ {\displaystyle {\hat {b}}} derived from the data parameterize the simple linear estimator y ^ = a ^ x + b ^ {\displaystyle {\hat {y}}={\hat {a}}x+{\hat {b}}} . The term "trend" refers to the slope a ^ {\displaystyle {\hat {a}}} in the least squares estimator.
Data as trend and noise To analyze a (time) series of data, it can be assumed that it may be represented as trend plus noise:
y t = a t + b + e t {\displaystyle y_{t}=at+b+e_{t}\,}
where a {\displaystyle a} and b {\displaystyle b} are unknown constants and the e {\displaystyle e} 's are randomly distributed errors. If one can reject the null hypothesis that the errors are non-stationary, then the non-stationary series { y t } {\displaystyle \{y_{t}\}} is called trend-stationary. The least-squares method assumes the errors are independently distributed with a normal distribution. If this is not the case, hypothesis tests about the unknown parameters a {\displaystyle a} and b {\displaystyle b} may be inaccurate. It is simplest if the e {\displaystyle e} 's all have the same distribution, but if not (if some have higher variance, meaning that those data points are effectively less certain), then this can be taken into account during the least-squares fitting by weighting each point by the inverse of the variance of that point. Commonly, where only a single time series exists to be analyzed, the variance of the e {\displaystyle e} 's is estimated by fitting a trend to obtain the estimated parameter values a ^ {\displaystyle {\hat {a}}} and b ^ , {\displaystyle {\hat {b}},} thus allowing the predicted values
… excerpt ends here. Continue reading the full article.

