Digital Salla

Regression Analysis in Financial Forecasting: Formulas, Example and Excel

Financial Analysis & Costing (FP&A)

Design titled "Regression Analysis in Financial Forecasting: Formulas, Example and Excel", showing a scatter plot of power cost against machine hours with the regression line and a forecast point at 750 hours, an Excel functions card (SLOPE 8, INTERCEPT 2000, RSQ 0.9859, FORECAST.LINEAR 8000), and ŷ = 2,000 + 8X and R² = 0.9859 badges.

Linear regression is used in forecasting: it estimates, from historical data, how a dependent variable such as sales or cost relates to one or more independent variables such as machine hours or marketing spend, then uses that relationship to estimate new values. Microsoft describes Excel's FORECAST.LINEAR function as predicting a future value from existing values by using linear regression, and lists predicting future sales, inventory requirements and consumer trends among its uses.

This article sets out the method precisely: the least-squares slope and intercept, R² and residuals, assumptions and the limits of extrapolation, multiple regression and time series, with a fully worked example showing the sums, a comparison with the high-low method, the Excel functions, and where forecasts meet accounting estimates under IFRS.

What is simple linear regression?

The model assumes:

Y = a + bX + e

  • Y is the dependent variable to be forecast and X the independent variable (the driver).
  • b is the slope: the expected change in Y when X rises by one unit.
  • a is the intercept: the estimated value of Y when X is zero.
  • e is the residual: the difference between the actual value and the value on the line.

The least-squares method chooses the a and b that make the sum of squared residuals, Σe², as small as possible. Microsoft states that LINEST uses this method to calculate the straight line that best fits the data.

The slope and intercept formulas

With x̄ and ȳ as the means:

  • Slope: b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²
  • Intercept: a = ȳ − b·x̄
  • Equivalent slope formula: b = (nΣxy − ΣxΣy) ÷ (nΣx² − (Σx)²), where n is the number of observations.

The coefficient of determination R² = 1 − (sum of squared residuals ÷ sum of squared deviations of y from its mean); in simple regression it equals the square of the correlation coefficient r.

Worked example: power cost and machine hours (illustrative figures)

A factory wants to forecast its monthly power cost (Y) from machine hours (X), using six months of data:

MonthXYx − x̄y − ȳ(x − x̄)(y − ȳ)(x − x̄)²ŷe = y − ŷe²
14005,400−250−1,800450,00062,5005,20020040,000
25005,800−150−1,400210,00022,5006,000−20040,000
36006,600−50−60030,0002,5006,800−20040,000
47007,8005060030,0002,5007,60020040,000
58008,4001501,200180,00022,5008,40000
69009,2002502,000500,00062,5009,20000
Total3,90043,200001,400,000175,0000160,000
  1. Means: x̄ = 3,900 ÷ 6 = 650 hours; ȳ = 43,200 ÷ 6 = 7,200.
  2. Slope: b = 1,400,000 ÷ 175,000 = 8 per machine hour.
  3. Intercept: a = 7,200 − 8 × 650 = 2,000 a month.
  4. Forecasting equation: ŷ = 2,000 + 8X, which gives the ŷ column; the residuals sum to zero.
  5. Sum of squared deviations of y: 1,800² + 1,400² + 600² + 600² + 1,200² + 2,000² = 11,360,000.
  6. R² = 1 − 160,000 ÷ 11,360,000 = 0.9859: about 98.6% of the variation in cost in this sample goes with the variation in machine hours.
  7. Standard error of the estimate: √(160,000 ÷ (6 − 2)) = √40,000 = 200.
  8. Forecast: for a month expected to run 750 hours, 2,000 + 8 × 750 = 8,000.

Check with the equivalent formula: Σxy = 29,480,000 and Σx² = 2,710,000, so b = (6 × 29,480,000 − 3,900 × 43,200) ÷ (6 × 2,710,000 − 3,900²) = 8,400,000 ÷ 1,050,000 = 8.

Two cautions on this example:

  • The 2,000 intercept corresponds to X = 0, a point outside the data (400 to 900 hours). Reading it as "fixed cost" is an estimate valid only within that range.
  • A forecast at 1,200 hours gives 11,600, but it is an extrapolation beyond the observed range that assumes the linear relationship continues where no data supports it.

For fixed, variable and mixed costs, see Cost behavior.

How to read the results

  • R² ranges from 0 to 1. Microsoft's RSQ page says it can be interpreted as the proportion of the variance in y attributable to the variance in x, and its LINEST page says that at 0 the regression equation is not helpful in predicting y. A high R² does not prove causation; both variables may move with a third factor.
  • Residuals should look random around zero. A pattern, such as positive residuals at both ends and negative ones in the middle, suggests the relationship is not linear.
  • The standard error of the estimate measures the amount of error in predicting y for an individual x, per the STEYX page. It is in the units of the dependent variable, which makes it easy to present to management.
  • The F statistic, per the LINEST page, is used to determine whether the observed relationship between the dependent and independent variables occurs by chance.

Assumptions and limits

Least-squares results are reliable for inference only under well-known statistical conditions:

  1. Linearity: the relationship is roughly linear within the data range.
  2. Independent residuals: one period's residual is not related to the previous one's.
  3. Constant variance: residuals scatter similarly across the values of X.
  4. Normally distributed residuals: needed for significance tests and confidence intervals, not for fitting the line itself.
  5. A stable relationship: changes in technology, prices or the business can make old data unrepresentative of the future.

The most serious mistakes in practice are extrapolating far beyond the data, relying on very few observations and leaving outliers unexamined.

Multiple regression

When more than one variable explains Y:

Y = a + b₁X₁ + b₂X₂ + … + bₖXₖ + e

  • Each coefficient bᵢ measures the expected change in Y for a one-unit change in its variable, with the other variables held constant.
  • R² does not fall when a variable is added, even a useless one, which is why adjusted R², which accounts for the number of variables, is used.
  • Multicollinearity: when the independent variables are highly correlated with each other, the coefficients become unstable. Microsoft notes that LINEST checks for collinearity and removes redundant columns, which then show a zero coefficient and a zero standard error.

Regression on time series

When X is time itself (a month number, say), regression estimates a trend. Particular cautions apply:

  • Seasonality: where monthly or quarterly patterns recur, dummy variables (0 or 1) for seasons can be added instead of a single line.
  • Residuals correlated over time: this can occur in time series and weakens statistical inference.
  • Spurious correlation: two series that both rise can give a high R² with no real link between them.
  • Structural breaks: a new product or a pricing change can break the historical relationship.

For building and maintaining forecast assumptions, see Building financial forecasting assumptions and Rolling forecasts.

High-low method vs regression

The high-low method uses only two observations, the highest and lowest activity levels. On the example data:

  • Slope = (9,200 − 5,400) ÷ (900 − 400) = 3,800 ÷ 500 = 7.6 per hour.
  • Fixed element = 9,200 − 7.6 × 900 = 2,360.
  • Forecast at 750 hours = 2,360 + 7.6 × 750 = 8,060, against 8,000 by regression.
High-lowRegression
Observations used2 of 66 of 6
Slope7.68
Fixed element2,3602,000
Measure of fitNoneR² and standard error

The high-low method is quicker but is driven by any anomaly in the two months chosen; regression uses all the data and measures how well the line fits.

Excel functions for regression

Assume X is in A2:A7 and Y in B2:B7. Note that the known y-values come before the known x-values in these functions:

FunctionFormulaReturnsResult in the example
SLOPE=SLOPE(B2:B7,A2:A7)Slope of the regression line8
INTERCEPT=INTERCEPT(B2:B7,A2:A7)Point where the line crosses the y-axis2000
RSQ=RSQ(B2:B7,A2:A7)Square of the Pearson correlation coefficient0.9859
STEYX=STEYX(B2:B7,A2:A7)Standard error of the predicted y-value200
FORECAST.LINEAR=FORECAST.LINEAR(750,B2:B7,A2:A7)Predicted y for a given x8000
LINEST=LINEST(B2:B7,A2:A7,TRUE,TRUE)Coefficients and additional statistics as an array8 and 2000 in the first row

Notes from Microsoft's documentation:

  • In Excel 2016, FORECAST was replaced with FORECAST.LINEAR; syntax and usage are the same. FORECAST will eventually be deprecated and remains available for backward compatibility.
  • LINEST returns the array {mn,…,m1,b}: the variable coefficients in reverse order, then the constant. const set to FALSE forces the constant to zero; stats set to TRUE adds the standard errors of the coefficients and constant, R², the standard error of the y estimate, the F statistic, degrees of freedom, and the regression and residual sums of squares.
  • SLOPE and INTERCEPT use a different algorithm from LINEST, which can give different results when the data is undetermined and collinear.

For other functions accountants use, see Key Excel functions for accountants.

From forecasts to accounting estimates

When a forecast feeds a figure in the financial statements, the Standards set conditions, including:

  • Value in use for impairment testing: an entity shall base cash flow projections on reasonable and supportable assumptions representing management's best estimate of the range of economic conditions over the asset's remaining useful life, with greater weight given to external evidence; on the most recent budgets or forecasts approved by management, excluding cash flows expected to arise from future restructurings or from improving or enhancing the asset's performance, over a maximum of five years unless a longer period can be justified. Beyond that, projections are extrapolated with a steady or declining growth rate unless an increasing rate can be justified, and the rate shall not exceed the long-term average growth rate for the products, industries, country or countries, or market unless a higher rate can be justified (IAS 36.33).
  • Testing past forecasts: management assesses the reasonableness of its assumptions by examining the causes of differences between past cash flow projections and actual cash flows, and shall ensure current assumptions are consistent with past actual outcomes, provided the effects of subsequent events or circumstances that did not exist when those cash flows were generated make this appropriate (IAS 36.34). The idea is close to examining residuals. For ongoing tracking, see Financial variance analysis.
  • Estimation technique: an entity uses measurement techniques and inputs, including estimation techniques, to develop an accounting estimate (IAS 8.32A). If a regression model is the technique behind an accounting estimate and the technique or its inputs change, the effect is a change in accounting estimate unless it results from correcting a prior period error (IAS 8.34A), recognised prospectively, other than a change to which paragraph 37 applies (IAS 8.36). See Accounting estimate vs accounting policy.
  • Fixed and variable costs in inventory: IAS 2 distinguishes fixed production overheads, which remain relatively constant regardless of the volume of production, from variable ones, which vary directly or nearly directly with it (IAS 2.12). Fixed overheads are allocated on normal capacity and variable overheads on actual use of the production facilities (IAS 2.13). Regression is one statistical way to estimate the fixed and variable parts of a mixed cost.

A practical tool

Once you have estimated the fixed and variable parts of factory overheads, the Cost Accounting for Small Factories (Process Costing) Excel file, in Arabic, absorbs fixed overheads on normal capacity and variable overheads on actual hours, and calculates unit cost and work in process. It does not perform regression or estimate the fixed and variable split, and it has no job-order cost register.

Sources

Blog

A tool for this topic

Apply what you read with a ready file

Specialized Sectors

Factory Cost Accounting

Compute your factory's unit cost by process costing (continuous production), allocating overheads to production centers, value finished goods and work in process, and analyze variances.

View details