Lawfare Academy · Complete Regression and Business Forecasting edition 6
Build a forecast, preserve its information set and assess its uncertainty
A time index is not an availability timestamp
Define target, units, issue time, cutoff, horizon and permitted revisions. Completed jobs are not unconstrained demand; invoices are not receipts. Calendar-month sums and average daily rates answer different questions when working days differ. A revised supplier-price series can look historical while being unavailable at the old origin. Preserve the first release or appropriate vintage before calling a backtest operational. Missing historical vintages are an evidence limitation, not permission to use hindsight values.
Time plots reveal level shifts, trend, seasonal repetition and changing variability. Seasonality is tied to a known calendar period; a business cycle need not repeat on a fixed schedule. An autocorrelation at lagk compares centered pairs separated byk using a stated convention. For one common descriptive convention r_k=sum fromt=k+1 throughT of[(y_t-ybar)(y_(t-k)-ybar)] divided bysum fromt 1 throughT of(y_t-ybar)². Short-series estimates are unstable and a trend can create apparent autocorrelation. A diagnostic is a clue to a model, not an automatic order-selection rule.
Benchmarks must be executable at the origin
With data throughT, a historical-mean forecast is ybar_T; naive isy_T; seasonal naive repeats the latest observed corresponding season; drift is y_T+h*(y_T-y_1)/(T-1) forT>1. These assumptions differ: mean assumes a stable level, naive persists the last level, seasonal naive persists the seasonal pattern and drift extends the average endpoint change. A trailing moving average smooths noise but can lag trend. Every method uses only allowed past data. These are serious comparison baselines, not proof that one should always win.
Use a separate original quarterly fixture(80,100,120,100,88,110,132,110), observed through quarter 8. Mean 105,naive 110 andone-step drift 110+(110-80)/7=114.285714 give quarter 9 forecasts 105,110,114.285714. Seasonal naive uses quarter 5 and gives 88. Forquarter 10 ituses quarter 6 and gives 110. Choosing a full-series mean after observing future quarter 9 would invalidate the earlier mean forecast. Two years are too short to establish a stable seasonal law, but they make each admissible benchmark reproducible.
An additive seasonal decomposition y_t=T_t+S_t+R_t treats seasonal differences as roughly stable amounts. A multiplicative form y_t=T_t*S_t*R_t can describe proportional amplitude for positive data. For a deliberately specified independent model, seasonal factors(.8,1,1.2,1)average 1 and annual base level 100 predict(80,100,120,100). If the next base level is 110, predictions(88,110,132,110)match the second year. This is a stipulated teaching construction, not an estimated discovery from eightvalues. It explains why a proportional seasonal effect grows with level. A log form can turn multiplicative components into additive terms, with retransformation distinctions fromunit 4 still required.
Trend and seasonal regression is linear in coefficients
An additive quarterly model can be written y_t=a+b*t+c 2*Q 2+c 3*Q 3+c 4*Q 4+epsilon_t, withquarter 1 reference. To see its estimability use the separate exact fixture y_t=100+2 t+10 Q 2+20 Q 3-5 Q 4 for t 1 through 8: outcomes(102,114,126,103,110,122,134,111). The design has five coefficients andeightrows, leavingthree residualdf; its exact synthetic SSE 0 must not be advertised as precise real forecasting. Quarter 9 prediction 118 andquarter 10 prediction 130 extend the stipulated trend and category effects. If the future does not maintain that structure, the formulas fail despite perfect historical fit.
For a real regression fit, forecast exogenous predictors only when known at issue time, otherwise supply explicit scenarios or a joint forecast model. An actual future promotion scheduled and fixed today differs from realized future weather learned later. Conditional intervals that fix a predictor do not include its forecast uncertainty. If a coefficient maps an uncertain future inputXtoY=a+bX+epsilon with independent input error and innovation, Var(Yforecasterror)=b²Var(Xerror)+Var(epsilon), plus any coefficient uncertainty and cross-covariances. Withb 2,inputvariance 9 andinnovation variance 4,the total is 40,not 4. Independence is an assumption; a covariance between input error and innovation adds 2 bCov.
Updating a level and trend
Simple exponential smoothing uses levelL_t=alpha*y_t+(1-alpha)*L_(t-1),0<=alpha<=1; absent additional components its future point forecast staysL_T. Alpha 1 isnaive,alpha 0 neverupdates the initiallevel. On a separate sequence 100,110,105,120 with initial L 1=100 and alpha.5,levels 105,105,112.5 follow. A largeralpha reacts more rapidly but tracks noise. Initialization and parameter selection are part of fitting and must stay inside each evaluation origin.
Holt's additive trend method maintains L_t=alpha*y_t+(1-alpha)*(L_(t-1)+B_(t-1)), B_t=beta*(L_t-L_(t-1))+(1-beta)*B_(t-1), and pointforecasth=L_T+hB_T. WithstipulatedL 1=100,B 1=5,alpha=.5,beta=.25 andy 2=110,L 2=107.5 and B 2=5.625;the two-step forecast from origin 2 is 118.75. A damped trend instead accumulatesphi+...+phi^h timesB_T for 0<phi<1, limiting indefinite linear extrapolation. Seasonalsmoothing adds a seasonal state with an explicit period and enough cycles; its initialization and additive/multiplicative assumptions cannot be inferred from a package's default. This course's numeric scope demonstrates simple and additive-trend updating, seasonal benchmarks/regression and the preserved autoregressive/reconciliation examples; it does not claim every ARIMA or state-space estimator is fully taught.
Process uncertainty and parameter uncertainty remain distinct
Retain the full preserved AR 1 case y_t=100+.8(y_(t-1)-100)+epsilon_t with known normal innovation SD 3 andlast value 120. Means 116,112.8,110.24 andvariances 9,14.76,18.4464 followbyiteration. Long-horizoninnovation variance tends 25 whenabs(phi)<1. Ifphi 1,the model is a random walk with mean 120 andvariance 9 h. Estimating phi and the mean adds uncertainty not covered by plugging estimates into the known-parameter formula. The companion's covariance 37 for component variances 9 and 16 withcovariance 6 mustremain,aswellasitsknown-total 100 reconciliation 41.8919/58.1081. An uncertain executive total cannot be treated as exact without changing the problem.
For an h-step forecast, error includes innovations accumulated over h plus parameter and input uncertainty as applicable. Independent normal innovations justify the particular normal interval in that specified process; actual holdout coverage remains an empirical question. Report width as well as coverage and stratify by relevant horizon. Two components'95%endpoints cannot simply be added to obtain a total 95%interval. Overlapping horizons share outcomes, so a large count of origin-horizon pairs is not a large independent sample.
Reproduce an Excel regression without requiring Excel
For the exact 8-rowtrend/categoryfixture, puttime 1 through 8 inA 2:A 9,outcomeinB 2:B 9,andD 2:D 9=quarter 2 indicator,E=quarter 3,F=quarter 4. Build a contiguous predictor blockH:Kcontainingtime,Q 2,Q 3,Q 4 inthatorder. =LINEST(B 2:B 9,H 2:K 9,TRUE,TRUE) returns the slope coefficients in reverse column order followed by theintercept: firstrow -5,20,10,2,100. Confirm with manually reconstructed predictions; a copied equation with the wrong column order can look plausible while changing every forecast. A newrowfor t 9 needs(9,0,0,0);for t 10 needs(10,1,0,0). Do not enter all four quarter indicators alongside an intercept.
For optional Analysis ToolPak Regression, select Y and the contiguous X block, consistently mark labels if included and retain anintercept. Menu availability varies by device. Save the original paired rows, predictor construction, outputlabels and forecastcutoff. The exact fixture can havezero residual errors and degenerate inferential outputs; do not converttheseinto a real precision claim. Hand calculations and all required explanations here are complete. Excel/R device execution has not been verified, and no installation or outside visit is required.
Optional practice
Guided model: an honest seasonal benchmark
For the first quarterly fixture, quarter 9 seasonal naive is 88 and quarter 10 is 110. One-step drift is 800/7, or 114.285714, from latest value 110 and endpoint growth 30 over seven intervals. Changed fact: quarter 8 was released after the issue cutoff. Neither 110 as latest value nor its endpoint drift is then admissible. Rebuild all benchmarks using the actual available history and identify which seasonal values remain known.
Independent model: input uncertainty
With slope 2, input-error variance 9 and independent innovation variance 4, predictive error variance is 4*9+4=40. Changed fact: covariance between input error and innovation is 1. Add 2*2*1=4 to get 44. Coefficient estimation introduces additional uncertainty. An interval conditional on an input treated as known does not include these terms automatically.
Transfer model: smoothing is an issued procedure
Holt's stipulated origin-2 state L=107.5 and B=5.625 predicts horizon 2 as 118.75. Changed fact: alpha and beta were selected after looking at the final test outcomes. Those outcomes have become development data. Recreate selection within earlier origins, freeze the procedure and obtain an untouched evaluation. A good hindsight fit is not an issued forecast.
Unit rubric: 20 points
Award four points each for availability/target/horizon; reproducible mean, naive, seasonal and drift benchmarks; trend/seasonal representation and state updating; process/input/parameter/dependence uncertainty; and rolling selection with honest software limits. Complete model: quarter9 benchmarks are105,110,800/7 and88; the separate additive trend regression predicts118; Holt's two-step forecast is118.75; input variance is40 or44 under changed covariance. Retain the preserved AR1 and reconciliation assumptions. Keep independent cases distinct and do not promise operational coverage from synthetic examples.
Optional source summary: Forecasting: Principles and Practice, toolbox was read for benchmark definitions, forecast accuracy, transformations and time-series cross-validation. The source separates mean, naive, seasonal naive and drift methods and treats evaluation as distinct from fitting. All quarterly, smoothing and input-variance records here are original Academy constructions. The existing original AR1and reconciliation teaching is preserved, not borrowed from a publisher.
Optional software provenance: Microsoft LINEST documentation was read to confirm coefficient order, optional statistics and the intercept argument. The datasets and reproduction instructions are original; execution in a particular Excel installation is not claimed.