01 / 21

Forecasting
Pitfalls

Understand why forecasting models fail: from structural breaks that shatter assumptions to data leakage that inflates accuracy. Learn to spot, prevent, and fix these traps.

Business Analytics

What Is Forecasting?

Forecasting uses historical data to predict future values. A simple model might say: the value at time \( t+1 \) depends on past observations:

Assumption
Past patterns will continue into the future (stationarity).
Goal
Minimize forecast error \( e_t = y_t - \hat{y}_t \) on unseen data.

Two Major Pitfalls

Structural Breaks
The data-generating process itself changes: a new law, a pandemic, a market crash. The model's learned patterns no longer apply.
Data Leakage
Information from the future accidentally enters the training data. The model appears accurate but cannot replicate that performance in production.

Why This Matters

Every business decision built on a forecast inherits its errors. If the forecast is silently broken, the decisions are too.

1
Inventory planning: A structural break in demand causes overstock or stockouts worth millions.
2
Financial models: Leakage can make a trading strategy look profitable in backtesting but fail live.
3
Resource allocation: Hospitals forecasting patient arrivals saw models break during COVID-19: a textbook structural break.

Structural Breaks Defined

Time Value Break Point Pre-break trend Post-break reality Naive forecast

Detecting Breaks: The Chow Test

The Chow Test checks whether a single regression fits two sub-periods, or whether separate regressions are needed. It compares residual sums of squares:

Data Leakage Defined

Training Data Jan 2020 - Dec 2022 Test Data Jan 2023 - Dec 2023 Leakage: future info enters training Split Point

Breaks vs Leakage

Structural Break Data Leakage
Root Cause External event changes reality Flawed data pipeline or design
When Detected After deployment (model degrades) During validation (model seems too good)
Effect on Accuracy Accuracy drops suddenly Accuracy appears inflated
Fix Retrain, regime detection Fix data split, remove leaked features
Preventable? Not fully: world is unpredictable Yes: proper methodology

Types of Leakage

Target Leakage
A feature is derived from the target variable. Example: using "total charges" to predict whether a customer will churn: charges are calculated after the event.
Temporal Leakage
Training on shuffled time series data. The model uses tomorrow's price to predict today's: it "knows the future" via random train/test split.
Feature Leakage
Including a feature that is a proxy for the target. Example: using a "loan approved" flag to predict "loan default": approval data wouldn't exist for new applicants.

How to Prevent Pitfalls

1
Use time-based splits: Never shuffle time series data. Train on the past, test on the future: \( t_{\text{train}} < t_{\text{test}} \).
2
Audit every feature: Ask "Would I have this value at prediction time?" If not, remove it.
3
Monitor for structural breaks: Track forecast error over time. A sudden spike in \( |e_t| \) signals a potential regime change.
4
Use walk-forward validation: Retrain on expanding windows to simulate real deployment conditions.
5
Compare train vs test accuracy: If test accuracy is suspiciously close to or higher than training accuracy, investigate leakage.

Walk-Forward Validation

Train Test Fold 1 Train Test Fold 2 Train Test Fold 3 Time → Training window expands; test always follows chronologically

Example: Spotting a Structural Break

A retailer forecasts monthly sales using a linear trend model: \( \hat{y}_t = \beta_0 + \beta_1 t \). In March 2020, a lockdown occurs. Sales drop 40% overnight.

Mar 2020 Actual (pre-break) Actual (post-break) Forecast

Example: Spotting Data Leakage

A student builds a model to predict next-quarter revenue. The feature set includes "annual revenue" which is computed after all four quarters are known.

1
The leak: \( \text{Annual revenue} = Q_1 + Q_2 + Q_3 + Q_4 \). If you're predicting \( Q_4 \), the annual figure already contains \( Q_4 \).
2
The symptom: Test \( R^2 \approx 0.99 \). Suspiciously perfect: the model is essentially reading the answer.
3
The fix: Remove "annual revenue" or replace it with a trailing 4-quarter sum that excludes the target period.

Example: Temporal Leakage

Incorrect: Random Shuffle Split Test Train Train Test Train Test Train ✕ Correct: Chronological Split Train (past) Test (future) ✓ Time → Shuffled split lets the model peek at future neighbors of each test point

Common Mistakes

✕ Ignoring Regime Change
Assuming a model trained in 2019 will work in 2021. Always retrain after major events.
✕ Feature Engineering Before Split
Scaling, imputing, or encoding using the full dataset. The test set's statistics leak into training.
✕ Using Future Aggregates
Including "monthly average" computed across the entire month when predicting daily values within that month.

Summary of Key Concepts

Concept Definition Key Signal
Structural Break Permanent change in the data-generating process Sudden spike in forecast error
Target Leakage Feature derived from the outcome Near-perfect \( R^2 \)
Temporal Leakage Shuffled time series split Unrealistically high test accuracy
Feature Leakage Proxy variable for the target One feature dominates importance
Walk-Forward Chronological expanding-window validation Realistic error estimates

Question 1 of 5

A model that predicts next-month sales uses "annual total sales" as a feature. Annual total includes the month being predicted. This is an example of:

Question 2 of 5

An analyst randomly shuffles daily stock data from 2015-2023 and splits 80/20 for train/test. She reports \( R^2 = 0.94 \). What is the most likely problem?

Question 3 of 5

A restaurant chain's demand model was accurate for years, then suddenly over-predicts by 35% starting March 2020. This is best described as:

Question 4 of 5

Which validation strategy is specifically designed to prevent temporal leakage in time series forecasting?

Question 5 of 5

An analyst normalizes the entire dataset (train + test) before splitting. What type of leakage does this cause?