incrementality#
Incrementality and counterfactual analysis for Marketing Mix Models.
This module provides functionality to compute incremental channel contributions using counterfactual analysis, properly accounting for adstock carryover effects.
Concept#
Incrementality measures the causal impact of a marketing channel by comparing two scenarios:
Actual: the model prediction with real spend data.
Counterfactual: the model prediction with spend removed or perturbed.
The difference between these two predictions is the incremental contribution of that channel. Because MMMs include adstock transformations, spend at time t affects outcomes at t, t + 1, …, t + l_max. A naïve element-wise comparison ignores this temporal attribution; this module handles it correctly by extending the evaluation window to capture both carry-in and carry-out effects.
Total incrementality (zero-out counterfactual):
where the counterfactual spend zeroes out only the evaluation period:
Marginal incrementality (small perturbation):
where the perturbed spend scales only the evaluation period:
Here m is the channel, x the spend vector, L the adstock window
length (l_max), Ω the posterior parameter samples, and
α the counterfactual_spend_factor. Spend outside
\([t_0, t_1]\) is always kept at its actual value so that adstock
carry-in is correctly accounted for.
Incrementality is a general-purpose building block. Dividing incremental contribution by spend gives ROAS (Return on Ad Spend) when the model’s target variable is revenue; taking the reciprocal (spend / contribution) gives CAC (Customer Acquisition Cost) when the target is customer count. The same logic applies to any target variable.
Examples#
Compute quarterly incremental contributions:
incremental = mmm.incrementality.compute_incremental_contribution(
frequency="quarterly",
period_start="2024-01-01",
period_end="2024-12-31",
)
Compute quarterly ROAS (when target variable is revenue):
roas = mmm.incrementality.contribution_over_spend(
frequency="quarterly",
period_start="2024-01-01",
period_end="2024-12-31",
)
Compute monthly CAC (when target variable is customer count):
cac = mmm.incrementality.spend_over_contribution(
frequency="monthly",
)
Compute marginal ROAS (return on next dollar):
mroas = mmm.incrementality.marginal_contribution_over_spend(
frequency="quarterly",
)
References#
Google MMM Paper: https://storage.googleapis.com/gweb-research2023-media/pubtools/3806.pdf
Classes
|
Incrementality and counterfactual analysis for MMM models. |