Lawfare Group → Knowledge Institute → Lawfare Academy

← Course syllabus · Related lesson

Freeze the forecast before observing the outcome

Current complete on-site edition 6

Required teaching and complete optional models are supplied on LawfareGroup.com. Publisher and primary links are optional provenance or further reading. Florida is the contemporary state-law default; federal rules and explicitly comparative accounting frameworks are distinguished. Independent subject review and observed human learner testing remain pending.

Cumulative regression and forecasting dossier, transfer models and 30-point rubric

Preserved original teaching and transfer history, integrated with complete current on-site preparation. Independent human review/testing remain pending.

A forecast is a dated information claim

A forecast record needs more than a predicted value and an eventual outcome. Record the issue time, target period, horizon, information cutoff, method version and available predictor values. Without these, an analyst can accidentally compare a genuine advance forecast with a model that used data released after the decision. A month labeled March might refer to activity during March, publication in April or a corrected value available in June. Those distinctions determine whether a predictor could have been used at the forecast origin.

In rolling-origin evaluation, each origin uses only the prefix of observations available at that point, then predicts a later target. Advance the origin and repeat. If a model chooses transformations or tuning parameters, those choices must also use information available inside the training history. Applying a transformation selected from the entire series before splitting the data can leak later information even when the final fitted coefficients use only a prefix. A benchmark must receive the same admissible information set as the candidate.

This chapter uses a deterministic eight-period fixture so every one-step forecast is hand-checkable. It compares the last observed value with an expanding historical mean. The aim is to expose cutoff errors and model-selection consequences, not to prescribe either method universally. A short series cannot demonstrate dependable long-run superiority. In an operational setting, keep a final untouched evaluation period or conduct prospective monitoring after selection. Repeatedly choosing a new winner on the same small test set eventually uses that test set as training evidence.

Compute every origin before averaging the errors

The observed sequence is 100, 110, 120, 130, 140, 150, 160 and 170. Start with the first four periods as training. The targets are periods 5 through 8. The last-value method forecasts 130, 140, 150 and 160. Its actual-minus-forecast errors are 10, 10, 10 and 10, so MAE is 10 and RMSE is 10. Its bias under this sign convention is +10: it consistently underforecasts in this fixture.

The expanding-mean forecasts are 115, 120, 125 and 130. These use four, five, six and seven earlier observations respectively. Their errors are 25, 30, 35 and 40. MAE is 32.5; squared errors sum to 4350 and mean squared error is 1087.5, giving RMSE approximately 32.9773. Do not accidentally include the target in its own historical mean. The downloadable Python script asserts the entire forecast vectors, not merely the rounded average. That makes an off-by-one training cutoff visible even if two summary statistics happen to look similar.

The result supports a narrow comparison: last-value forecasts beat the expanding mean on these four one-step targets under both losses. It does not show that the last-value method captures the trend or that it is optimal. A simple drift extrapolation would predict this deliberately linear sequence exactly from an appropriate history, but its zero error here would reflect the construction of the fixture, not universal forecasting ability. The teaching point is that a valid comparison needs a clear benchmark and the full dated ledger. Report the example’s artificial regularity rather than implying that real business data will behave this cleanly.

A changed regime and an asymmetric decision can reverse the recommendation

Now keep the first four observations, but replace the later outcomes with 90, 90, 90 and 90. These are a separate changed-record scenario, not a correction silently substituted into the first evaluation. The last-value method predicts 130, 90, 90 and 90; its errors are -40, 0, 0 and 0, giving MAE 10 and RMSE 20. The expanding means are 115, 110, approximately 106.6667 and approximately 104.2857. Their absolute errors are 25, 20, approximately 16.6667 and approximately 14.2857, giving MAE approximately 18.9881. Their RMSE is approximately 19.4091. Last-value wins MAE, but expanding mean narrowly wins RMSE because that criterion penalizes the isolated large miss more heavily.

A business decision can impose different losses again. Suppose underforecasting costs 5 per unit and overforecasting costs 1. For a forecast f and actual y, use 5 times max(y-f,0) plus max(f-y,0), if those are the actual stipulated marginal costs. In the initial rising sequence, last-value costs 50 each period and expanding mean costs 125,150,175,200. In the changed low-demand sequence, all shown errors are overforecasts, so the mean losses equal the respective MAEs. Do not change the cost ratio after seeing which method it favors. Actual capacity, inventory expiry or service commitments may create nonlinear losses that this piecewise-linear example does not model.

Horizon matters too. If the operational decision commits two periods ahead, one-step errors do not directly validate it. Construct origins and targets at horizon two, and state whether the system reforecasts before the commitment becomes irreversible. A delayed input must be lagged according to its release time, not its convenient row label. A result that changes under a plausible corrected cutoff should lead to a revised recommendation, not selective reporting. Archive both ledgers, explain the defect and re-evaluate the candidate methods under the admissible information set.

Worked example

Use the eight-period rising sequence and four one-step origins. Compare last-value and expanding-mean forecasts, then repeat on [100,110,120,130,90,90,90,90].

Initial last-value errors are all 10, so MAE=RMSE=10. Initial expanding-mean errors are 25,30,35,40, so MAE=32.5 and RMSE=sqrt(1087.5)=32.9772648957. On the changed series last-value MAE=10 and RMSE=20. Expanding-mean MAE=18.9880952381 and RMSE is approximately 19.4091. Thus a single declared winner without naming the loss would conceal a reversal. The reproduction writes each origin’s training length, forecast, outcome and error, then independently checks both metric calculations.

Progressive independent practice

Write your analysis before opening each model. Then change the stated fact and revise the reasoning.

Foundation

At origin 4, a programmer computes the expanding average using observations 1 through 5 to predict period 5. Identify the defect and give the admissible forecast in the rising fixture.

Compare the model reasoning

Observation 5 is the target and was unavailable at origin 4. Use only 100,110,120,130, whose mean is 115. Including 140 leaks the outcome and produces 120, an inadmissible apparent improvement.

Changed conditions

Observation 4 itself is published only after the period-5 decision deadline.

Compare the revised analysis

The admissible history is shorter still. A row’s period label does not establish availability; reconstruct the information cutoff and recompute both methods using the same allowed information.

Application

In the low-demand changed scenario, choose a method under MAE and under RMSE and explain the difference.

Compare the model reasoning

Last-value wins MAE, 10 versus approximately 18.9881. Expanding mean wins RMSE, approximately 19.4091 versus 20. The squared loss gives greater weight to the last-value method’s initial 40-unit error. The metrics represent different penalties, not contradictory arithmetic.

Changed conditions

The business cannot tolerate any error larger than 30 units.

Compare the revised analysis

The observed last-value method violates the stipulated threshold once, whereas the expanding mean does not in this fixture. Assess threshold violations explicitly. This four-target observation is not a guarantee against future violations.

Transfer

A marketing predictor sharply improves a two-period forecast, but its values were revised after the target period. Design the recheck.

Compare the model reasoning

Recover the predictor vintages actually available at each origin and the relevant release delay. Rebuild the horizon-two training and prediction ledger, including tuning and preprocessing within the proper histories. Compare against admissible benchmarks under the predeclared operational loss and retain a separate final evaluation where feasible.

Changed conditions

Historical predictor vintages cannot be recovered.

Compare the revised analysis

The original claim cannot be validated as a real-time forecast using that evidence. Label the retrospective result’s availability limitation, avoid claiming operational superiority and begin prospective timestamped collection before making that stronger claim.

Source readings and scope

Hyndman and Athanasopoulos: Forecasting, Principles and Practice, forecaster’s toolbox — Conceptual reading on evaluation, benchmarks and forecast errors. The eight-period ledgers, cost comparisons and executable exercises are original Academy examples.

Reproduce the worked cases

Download the Python 3 laboratory. Uses only the standard library and synthetic data. Run locally; it does not access accounts, a network service or production records. Assertions check the stated results.