Forecasting using linear regression
This recipe illustrates the method of estimating the future values based on a linear trend. The linear trend is calculated using the least-square distance, a statistical method of determining the line that fits the best through the set of values in the chart, as displayed in the following figure:
Mathematically, linear regression can be represented by a regression line, y = ax + b, where y is the value of the y-intercept for a value of x.
Linear regression is often used in a way that x is a period and y is the value in a particular time, for example, a month.
Most importantly, the regression line is used to forecast values outside the initial period. For example, we can use a period of 60 months and forecast the value for each of the following 12 months.
This recipe shows how to estimate the values of the two months after the period of 36 months that were used in the calculation. The screenshot you saw in the introduction of this recipe shows the regression...