Lawfare Academy · Complete Regression Analysis for Business edition 3
Time-aware transformations, forecasting and loss
The original companion's 12,14,16,18,20,22,40,42 series, fixed versus rolling protocols and separate 100/120/80 business-loss example remain intact. This studio supplies the broader transformation, time and evaluation preparation with a new Willow series. A favorable training fit never establishes that an earlier operational forecast could have been produced from the information actually available then.
Build an information-time specification
Distinguish event date, recording date, revision date and forecast issue date. A feature must be available in usable form when the prediction is issued. A later paid status, revised statistic or retrospective group category can leak outcome information. A chronological split does not repair a feature pipeline built from the full dataset. Fit imputation, scaling, category handling, transformations and tuning within the permitted training information and reproduce that rule at each origin.
Serial correlation means observations or errors at different dates share information under the specified model. Trends, seasonality, persistent shocks and changing variance can affect both forecasts and uncertainty. Common time controls or unit fixed effects remove particular modeled components; they do not guarantee independent errors, stationary dynamics or causal identification. Differencing changes the target and available information rather than acting as a universal cure for a time pattern.
Choose the promised task: one fixed-origin future block, repeated one-step forecasts after updating, or a rolling multi-step horizon. Expanding windows retain all available past data; moving windows discard earlier data according to a stated rule. Benchmark and candidate must use matching issue dates, horizons and update opportunities. Reserve evaluation information from tuning, or describe the search and use another appropriate evaluation. If deployment predicts new customers as well as future dates, the split must also represent that distinction.
Transformations change prediction targets
A transformation can stabilize scale, respect positivity or express a substantive relationship. Logarithms require positive inputs. A Box-Coxfamily on its appropriate positive domain can use log(y)at lambda 0 and(y^lambda−1)/lambda for nonzero lambda. The inverse is exp(w)at zero and(lambda w+1)^(1/lambda)where defined otherwise. The model, domain and chosen lambda are assumptions or fitted choices that must be recorded; arbitrary additions to handle zeros change the relationship.
For a monotone transformation, an appropriately justified prediction interval can be mapped back by transforming its endpoints. Coverage carries through the same event under the transformation; this does not repair an invalid interval on the transformed scale. A back-transformed central prediction need not equal an arithmetic mean. If log Y is normal with conditional mean mu and variance v, its level mean is exp(mu+v/2), while exp(mu) is its median. Other distributions need another argument. The original companion's finite 50/200 example gives a direct demonstration without assuming lognormal errors.
Use independent Willow equally likely levels 80 and 320. Their log center is log 160, so exponentiating that center gives 160; the arithmetic mean is 200. The finite residual-exponential average is 1.25. A common retransformation factor does not automatically work when the residual distribution differs by group or horizon. Define whether the decision needs a median, expected total, quantile or another functional before selecting the output.
The relevant methodological explanations in Forecasting: Principles and Practice chapter 5 sections 5.6,5.8 and 5.10 were consulted for transformation targets, evaluation and time-ordered validation. Historical datasets, figures, package output and universal holdout proportions are not adopted as empirical evidence or required runtime behavior. This studio and the preserved full original applications supply all required methods on site.
Independent Willow fixed and rolling forecasts
Let periods 1 through 6 have outcomes 2,4,6,8,14,16. Fitting the first four gives trend yhat=2 t. From fixed origin 4 it predicts 10 and 12 for periods 5 and 6. Forecast-minus-actual errors are−4 and−4, MSE 16 and MAE 4. A matching fixed last-value benchmark predicts 8 and 8, errors−6 and−8, MSE 50 and MAE 7. Both forecasts use information only through period 4.
For a rolling one-step protocol, predict period 5 as 10, then refit after observing 14. With the first five values, the fitted intercept is−1.6 and slope 2.8, so period 6 forecast is 15.2. Errors are−4 and−0.8, giving MSE 8.32 and MAE 2.4. The matching rolling last-value benchmark predicts 8 then 14, giving MSE 20 and MAE 4. Report each within-protocol comparison separately. Comparing rolling 8.32 with fixed 50 would give the candidate an extra information advantage.
This six-value construction audits mechanics, not stable forecasting superiority. Its perfect initial fit misses a later change. More origins, relevant regimes, outcome completeness and uncertainty matter. Overlapping multi-step errors can be dependent, so uncertainty for average evaluation loss also needs a design argument. A point score by itself supplies neither a calibrated prediction distribution nor a causal effect.
Scores should match units and the decision
MAE averages absolute errors; MSE averages squared errors and RMSE is its square root. The mean minimizes expected squared loss under suitable finite moments, while a median minimizes expected absolute loss. Asymmetric loss can target another quantile or a constrained action. A capacity or inventory choice should be evaluated through its actual feasible decision rule and consequences, not only a symmetric forecast score.
Percentage errors divide by the actual outcome, so zero or near-zero actuals can make them undefined or unstable; scales without a meaningful zero make percentage interpretation problematic. Scaled errors use a stated training benchmark error as their denominator and require it to be nonzero. For fixed-origin Willow, the training naive absolute differences are 2,2,2, giving scale 2. Candidate MAE 4 has MASE 2 and benchmark MAE 7 has MASE 3.5. For a rolling protocol, declare how the scaling denominator updates; do not silently mix denominators from another evaluation.
Prediction intervals concern the distribution of future outcomes under specified information. Check interval coverage and width across relevant horizons or groups, not only point accuracy. A wider interval can improve coverage while becoming unhelpful; use a justified interval scoring or decision criterion where needed. Record how forecasts are revised without rewriting past evaluations as if the final model had been known earlier.
Optional complete models
Model 1 — Extra future information is given only to the favored model
Willow fixed-origin trend MSE 16 must be compared with fixed benchmark 50. Rolling trend 8.32 compares with rolling benchmark 20. Changed fact: the operational product updates after every observed outcome. Select the matching rolling task for both methods and retain the one-step horizon. Do not claim 8.32 versus 50 as a fair model improvement.
Model 2 — The log center is called expected level revenue
For Willow levels 80 and 320 with equal probability, exp(meanlogY)=160 and meanY=200. Changed fact: one group's conditional residual distribution changes. Recompute or model that group's level mean rather than borrow 1.25 as a universal multiplier. A correctly interpreted log coefficient can still fail to answer the expected-total decision.
Model 3 — A percentage metric is applied to zero outcomes
Define the actual denominator before interpreting an error percentage. With actual zero the usual absolute percentage error is undefined. Changed fact: the training naive error scale is also zero because all training values are identical. A scaled-error metric can also fail. Choose and justify a compatible measure or report the limitation; adding a convenient constant changes the score and does not automatically preserve its meaning.
Optional rubric 20 points: information dates and transformations 4; exact fixed/rolling reconstruction 4; valid matching benchmarks 4; units/loss/interval interpretation 4; changed-fact revision 4. These models establish no actual business or learner performance. Human subject review and observed learner testing remain separately pending.