Lead/Lag Transformations
Shifting Variables in Time
Lead/Lag transformations shift variables forward (lead) or backward (lag) in time, allowing you to model delayed or anticipated effects in your MMM.
What Are Lags and Leads?
Lag (Backward Shift)
Definition: Use past values of a variable
Example:
Original TV_Spend:
Week 1: $10,000
Week 2: $12,000
Week 3: $8,000
TV_Spend_lag1 (1-week lag):
Week 1: (missing)
Week 2: $10,000  ← Last week's value
Week 3: $12,000  ← Last week's valueUse Case: Model delayed effects
Lead (Forward Shift)
Definition: Use future values of a variable
Example:
Original Sales:
Week 1: $150,000
Week 2: $148,000
Week 3: $152,000
Sales_lead1 (1-week lead):
Week 1: $148,000  ← Next week's value
Week 2: $152,000  ← Next week's value
Week 3: (missing)Use Case: Model anticipatory behavior (rare in MMM)
When to Use Lags
Delayed Marketing Effects
Scenario: Direct mail takes 2-3 weeks to generate responses
Solution:
Create: DirectMail_lag2
Model: Sales ~ DirectMail_lag2Interpretation: Direct mail sent 2 weeks ago affects today's sales
Price Adjustments
Scenario: Price changes take time for consumers to notice
Solution:
Create: Price_lag1
Model: Sales ~ Price_lag1Economic Indicators
Scenario: Macroeconomic factors affect business with delay
Solution:
Create: Unemployment_lag4  (monthly data)
Model: Sales ~ Unemployment_lag4When NOT to Use Lags
Don't Confuse with Adstock
Lag ≠ Adstock:
- Lag: Uses only the past value (single period) 
- Adstock: Accumulates decaying effects across multiple periods 
Example:
Lag: Only Week 2 spend affects Week 3
Adstock: Week 1, 2, 3... all affect Week 3 (with decay)For media channels, use Adstock, not Lag
Creating Lead/Lag Variables
In Variable Workshop
Step 1: Select base variable
Step 2: Choose "Lead/Lag Transformation"
Step 3: Configure:
- Direction: Lag (backward) or Lead (forward) 
- Periods: Number of weeks/months to shift (1, 2, 3...) 
Step 4: Preview transformation
Step 5: Create variable
Naming Convention
Recommended format:
{Variable}_lag{n}   for lags
{Variable}_lead{n}  for leads
Examples:
Price_lag1
DirectMail_lag3
Sales_lead1  (rare)Multiple Lags
Testing Different Lag Lengths
Create multiple lags to test:
TV_lag1
TV_lag2
TV_lag3Test in model: Which lag has highest t-statistic?
Use: Most significant lag period
Distributed Lag Models (Advanced)
Include multiple lags simultaneously:
Sales ~ TV_lag0 + TV_lag1 + TV_lag2Captures: Effect distributed across multiple periods
Note: Can cause multicollinearity - use cautiously
Handling Missing Values
First Period Issue
Problem: Lag creates missing value for first observation
Example:
TV_lag1:
Week 1: (missing)  ← No prior week
Week 2: $10,000
Week 3: $12,000MixModeler Solution: First period automatically filled with zero or excluded from analysis
Best Practices
✅ Use lags for non-media variables (price, promotions, direct mail)
✅ Test multiple lag lengths (1, 2, 3 periods) to find optimal
✅ Use adstock for media channels (not lags)
✅ Document lag choice rationale (why 2 weeks, not 1 or 3?)
❌ Don't over-lag (rarely need more than 4-week lag)
Summary
Key Points:
⏮️ Lags shift backward - use past values
⏭️ Leads shift forward - use future values (rare)
⏱️ For delayed effects - direct mail, price changes, economic factors
🎯 Test multiple periods - find optimal lag length
🚫 Not for media channels - use adstock instead for carryover
Simple but powerful transformation for modeling time-delayed relationships!
Last updated