Linear regression is a powerful mathematical tool that allows you to take results from your business statistics and project them into the future. You can take data such as sales figures, staff levels or costs and apply linear regression to determine future values. A typical application is to forecast sales for the next few months based on the monthly sales figures from the past year. The tool gives accurate results as long as past trends remain the same.

Look for Trends

The linear regression tool derives a linear equation from a set of variables. If you want to forecast sales figures, the data is in the form of a pair of values: month 1 and sales amount 1, month 2 and sales amount 2, etc. The derived equation represents a line drawn through the data points that best fits the average trend. You can use the equation to forecast future data by putting in the number of a future month and calculating the forecast sales.

Identify Your Variables

The linear regression technique works with any two variables. But in forecasting, one of your variables is time and the other is the variable for which you need the forecast. For example, for a sales forecast, assume that at the end of month one your sales were at 12,000 units. At the end of months two, three and four, sales were at 14,000, 15,000 and 17,000. The following example uses linear regression to forecast sales for months five and six.

Calculate the Sums and Averages

Define the number of months as x and your monthly sales in thousands as y. In the example, your data points (x,y) are (1,12), (2,14), (3,15) and (4,17).

The first step is to total all the x values and all the y values and find the average of each. For the example, define your total sales in thousands as Yt, which equals 58. Define the total number of months as Xt, equal to 10. The average sales, called Ya, were 58/4 = 14.5. The average number of months, called Xa, were 10/4 = 2.5.

Calculate the Squares, Products and Totals

Calculate the squares of each x value, the total of the squares of x, the products of each x and y value pair and the total of the products. For the example, the squares of the x values are 1, 4, 9, and 16, and their sum is 30. Call this total X2t. The products of each x and y value pair are 1 x 12, 2 x 14, 3 x 15 and 4 x 17. The results are 12, 28, 45, 68 and the sum is 153. Call this value XYt.

Perform a Linear Regression

To find b and c in the equation y = bx + c, calculate Sxx, which is the sum of the squares of x, X2t = 30, minus the square of the sum of the x values, Xt squared = 100, divided by the number of data points, which is four. Sxx = 30 - 100/4 = 5.

Calculate Sxy, which is the sum of the products of x and y, XYt = 153, minus the sum of the x values, Xt = 10, times the sum of the y values, Yt = 58, divided by the number of data points, which is four. Sxy = 153 - 580/4 = 8.

Find the Equation and Calculate Your Forecast

The equation for your sales forecast in thousands is y = 1.6x + 10.5. The sales forecast for month 5 is 1.6 times 5 plus 10.5 = 18.5 and the sales forecast for month 6 is 1.6 times 6 plus 10.5 = 20.1. Your sales under present trends will be 18,500 and 20,100 in months five and six.

References

About the Author

Bert Markgraf is a freelance writer with a strong science and engineering background. He started writing technical papers while working as an engineer in the 1980s. More recently, after starting his own business in IT, he helped organize an online community for which he wrote and edited articles as managing editor, business and economics. He holds a Bachelor of Science degree from McGill University.