Fit a least-squares cost line by using every included activity-and-cost pair to estimate a slope and intercept, then inspect the difference between each recorded cost and its fitted value. Keep the original observations, calculate the squared errors, and test the frozen line against later information before using it for a commitment.
The line can be the best fit under its mathematical rule without being a good description of your operation. A spreadsheet can minimize historical error while missing a changed price, different work mix or required capacity step.
Define one comparable record
Suppose a fictional small production service has six equally long reporting periods. In each period, x counts comparable completed batches and y records the complete defined service cost in dollars. The boundaries, product definition and expense basis are consistent. No observation is missing.
The original paired records are (1, $122), (2, $138), (3, $160), (4, $180), (5, $198) and (6, $222). These numbers are invented for a reproducible exercise, not collected business results.
We will fit an intercept plus one activity slope: estimated cost = a + bx. Every observation receives equal weight. This is not a line forced through zero, a weighted regression, a multiple-predictor model or a model of a count's probability.
Do not sort the costs independently from the activities. Each pair describes one period. Also decide whether you are fitting expense, invoice amounts or actual cash payments. A line fitted to one basis cannot silently become an estimate on another.
Calculate the centered sums
First find the means. Total activity is 21 batches, so average activity is 3.5. Total cost is $1,020, so average cost is $170.
Subtract the mean activity from each activity observation. The centered activities are −2.5, −1.5, −0.5, +0.5, +1.5 and +2.5. Their squared values add to 17.5.
Subtract $170 from each cost. The centered costs are −48, −32, −10, +10, +28 and +52 dollars. Multiply each centered activity by its corresponding centered cost. The six products are 120, 48, 5, 5, 42 and 130, totaling 350.
The slope is 350 divided by 17.5, or $20 per batch. The intercept is mean cost less slope times mean activity: $170 − $20 × 3.5 = $100 per period.
Our fitted line is therefore estimated period cost = $100 + $20 × batches. Preserve the units: multiplying a cost per batch by batches produces dollars, which can be added to the period intercept.
NIST's least-squares explanation gives the centered-sum slope and intercept formulas and defines the fitting criterion as minimizing summed squared deviations. The six-period record and all calculations here are original.
Reconstruct every fitted value
At activities one through six, the line gives estimated costs of $120, $140, $160, $180, $200 and $220. Subtract each estimate from its actual paired cost to obtain residuals of +$2, −$2, $0, $0, −$2 and +$2.
A residual is recorded cost minus fitted cost. A positive value means the record is above the line; it does not automatically mean waste, overpayment or someone's mistake. The line is an estimate rather than the record itself.
Squaring those residuals gives 4, 4, 0, 0, 4 and 4. Their sum is 16 squared dollars. Ordinary least squares chooses the coefficients that minimize that sum for this specified unweighted straight-line model with an intercept.
Two useful arithmetic checks also hold. The residuals add to zero, and multiplying each residual by its activity and adding gives zero. Here the second sum is 2 − 4 + 0 + 0 − 10 + 12 = zero.
Those checks help detect calculation mistakes. They are properties of this fitted construction, not evidence that the model has discovered the operation's true cost law.
Compare with an endpoint line without changing the records
The high-low guide estimates a line from the highest and lowest activity observations. Applied to these same fictional records, the endpoint slope is ($222 − $122) divided by (6 − 1), also $20 per batch.
But its intercept is $122 − $20 × 1 = $102. That line passes through the two selected endpoints and predicts $122, $142, $162, $182, $202 and $222.
Its residuals are $0, −$4, −$2, −$2, −$4 and $0. Squaring and adding gives 40 squared dollars, compared with 16 for the all-observation least-squares line.
The endpoint line has zero error at the endpoints because it was constructed to pass through them. Least squares fits all six records according to a different rule. Neither rule has established a future payment obligation or made either historical cost disappear.
Do not say the $24 difference between the two squared-error sums is a $24 saving. It is a difference in squared-dollar fit statistics. The actual six recorded costs still total $1,020 under either analysis.
Understand what an interior record can change
Consider a separate version of the data in which the third period's recorded cost is $220 instead of $160. All other records stay the same. This is an alternative supplied record, not permission to alter the original.
The highest and lowest activity observations are unchanged, so the endpoint line remains $102 + $20x. Least squares, however, includes the changed interior observation. Average cost rises to $180; the activity mean remains 3.5.
The centered cross-product sum becomes 320. Dividing by 17.5 gives a new slope of $128/7, approximately $18.285714 per batch. The new intercept is $116.
The changed record raised total cost, yet the fitted slope fell. That is possible because the extra cost sits below the mean activity. The line's intercept and slope shift together; their labels cannot tell you what caused that observation.
At four batches, the original all-record line estimates $180. The alternative fit estimates $116 + 4 × $128/7, approximately $189.14. Preserve both versions and investigate the record rather than choosing whichever prediction is convenient.
Change the activity unit without changing the result
Suppose every batch in this record contains exactly ten identical units. Relabeling activity in units changes the six x values to 10, 20, 30, 40, 50 and 60. It does not change any recorded period cost.
The fitted slope becomes $2 per unit, while the intercept remains $100 per period. Four batches and forty units both give the same $180 estimate. Keeping the old $20 slope beside the new forty-unit input would produce $900 instead, a unit error rather than a changed operating forecast. Preserve the definition of a batch before comparing coefficients from different reports.
Keep a good fit in perspective
For the original six observations, squared deviations of recorded costs from their $170 mean total 7,016 squared dollars. The fitted residual sum is 16, so the usual intercept-model R-squared is 1 − 16/7,016, approximately 0.99772.
That figure says the fitted line accounts for about 99.77% of the variation around the mean in this tiny original record. It does not mean a future cost estimate is 99.77% accurate, that the slope is causally established or that every error will stay within $2.
NIST's model-validation guidance specifically cautions that high R-squared does not guarantee good fit and emphasizes examining residuals. Retain their order and relationship to activity; an attractive summary can hide systematic patterns.
Six tidy observations are not a substitute for representative operating evidence. Check price changes, batch composition, omitted required work and whether the activity measure is meaningful. The intercept at zero activity is an extrapolation here because the observed range starts at one batch.
Test a frozen line on a later period
Return to the original $100 + $20x fit and freeze it before looking at a seventh period. That later period produces four comparable batches and records a complete cost of $260.
The frozen prediction is $180. The later error is therefore +$80. It lies well beyond the original fitted residuals of zero or two dollars in magnitude. The original R-squared remains a description of the six training records; it does not erase this later outcome.
Investigate the difference. Do not immediately add the seventh observation, refit and describe its new fitted value as though it had been the original prediction. Keep the issued estimate, actual outcome, investigation and any new model as separately dated versions.
If the model is eventually revised, test the revised assumptions and preserve what changed. No specific cause for the $80 difference has been supplied here. Calling it inflation, a repair or inefficiency would invent evidence.
Do not read cash or causation out of a coefficient
The fitted $20 slope is a historical association in this defined record. It does not establish that accepting one more batch will require exactly $20 of extra cash. Required staffing, minimum purchases, price terms and resource steps need their own evidence.
Nor does the fitted $100 intercept prove a cancelable $100 monthly bill exists. A statistical intercept combines the model's fit and scope; an actual fixed commitment comes from operating and contractual records.
The flexible-budget guide applies an established cost model to a specified activity level. Here the task is estimating and checking that model. Do not skip the evidence between those stages.
Test the fit before relying on a budget
A second way to investigate the original six-period fit is to ask how much the estimate changes when a boundary observation is set aside. This is a sensitivity exercise using the same fictional record, not a correction, an instruction to discard an inconvenient cost, or an independent test of future performance. Retain the full original data and the original fitted line beside both recalculations.
First set aside period six, the observation of six batches and $222. Fit the other five pairs using the same ordinary least-squares rule with an intercept. Their fitted line is $101.40 + $19.40 × batches. At the held-out six batches it predicts $217.80, which is $4.20 below the held-out recorded $222. The full six-record line predicts $220 at that activity, but it was fitted using the $222 observation; it is not a held-out prediction for that observation.
Now restore period six and set aside period one, the observation of one batch and $122. The five remaining observations give $97.20 + $20.60 × batches. At one batch that line predicts $117.80, again $4.20 below its held-out record. The two exercises use different training sets. Neither permits a conclusion that an endpoint is erroneous or that future errors cannot exceed $4.20.
The coefficients differ even though both reduced fits are close to the original $100 + $20x line. At four batches their estimates are $179.00 when period six is set aside and $179.60 when period one is set aside, compared with the original $180. This comparison answers a bounded question about these particular records and this one activity level. A different forecast location or a less stable history could produce a much wider spread.
Suppose a fictional manager has $182 available for the entire defined cost pool at four batches, with all costs paid before receipts. The original line leaves $2; the two reduced lines leave $3 and $2.40. Each calculation is arithmetically within the stipulated funds, yet that narrow margin does not establish a feasible cash plan. In the article's separate later-period test the same four batches actually cost $260: that supplied outcome exceeds $182 by $78. The small spread among fitted lines did not predict that later mismatch.
To decide whether to commit, check the actual scope and payment dates, capacity, supplier terms and plausible changes in the cost pool. A written quote or evidenced cost schedule may be more useful for the immediate obligation than a historical fitted value. If required payments exceed available funds before receipts, identify funding or change the plan rather than describing the fitted line as a guarantee.
Preserve when each estimate was made. The two five-record fits above are constructed after the complete six-period record is available; they are diagnostic demonstrations, not historical forecasts that anyone actually issued. A real backtest needs the records and method that were available at each earlier cutoff. Selecting a preferred method after viewing its test results also means that evaluation is no longer untouched.
Do not infer a formal prediction interval, probability of a budget shortfall or causal effect from these two sensitivity checks. Six periods are a small and deliberately tidy example, and the later $260 record illustrates a possible change without supplying its cause. A good decision record names what would invalidate the estimate and who will check those conditions before money is committed.
Retain the record and the failures
Keep the matched observations, period and cost definitions, included and excluded records, means, centered sums, coefficients, fitted values, residuals and the later-period test together. Preserve any supported correction separately from the original record.
If every activity value is identical, the centered activity sum of squares is zero. The slope formula then cannot distinguish an activity effect. More decimal places or a forced zero intercept would answer another question rather than supply the missing variation.
Explore Infinite Upside
For Vijay Sheth’s personal accounts, read Infinite Upside: Building Wealth With Room to Live, published by Sheth Capital, Inc.
Choose an edition
Choose an edition