Marketing Mix Modeling
Fit aggregate sales or another KPI using media inputs and measured factors such as prices, promotions, and seasonality.
What a mix model estimates
Baseline and control terms represent demand under the model’s reference inputs. A comparison with no paid media can hold organic activity, prices, and promotions at their observed values. Media terms can include lag and saturation.
Different channel contributions can fit the same sales history. Interpreting a modeled response as the effect of a spend change requires a credible causal comparison and a response that transfers to the new plan. A lift test checks the specific change it tested.
Two models can fit the same sales history
In this synthetic market-week panel, Search and Social usually move together. Toggle the priors to see how similar revenue fits assign different amounts to each channel. Revenue is the KPI in this example.
μ[g,t] = b + γ × demand[g,t] + βSearch,g × tanh(ASearch,g,t/4000) + βSocial × tanh(ASocial,g,t/4000)
- Baseline and controls. A shared intercept b and a pre-treatment demand index explain revenue outside the paid schedules. A richer baseline can interpolate between time knots. More knots increase flexibility and can absorb spend-correlated variation. Some implementations can select knots automatically.
- Media. Effective-dollar exposure A uses a carryover rate λ of 45% on the prior week’s exposure and a weight of 55% on current spend. A shared tanh curve applies saturation next. Search uses a population amplitude plus a zero-mean market deviation. Carryover rate and shape are fixed and shared. A national model would use one series and omit the market deviations.
- Outcome. Weekly revenue has a Gaussian likelihood with mean μ and a fixed $1,100 residual standard deviation. This example treats residuals as independent. Real geo-week residuals may be serially correlated.
Demand can raise both spend and sales (spend ← demand → sales). Identify the variation remaining after demand and other channels are accounted for. A proxy may miss relevant demand, and adjusting for a variable changed by advertising can block part of the effect. Spillover can change the comparison across markets. Inspect confounding and adjustment. See the randomized holdout example. Trace a media funnel.
Why randomize a change in spending?
Under the historical policy, spend can predict demand because teams raise budgets when they anticipate more sales. A lottery breaks that link for the assigned change. Omitted demand can bias historical attribution in either direction. The randomized contrast isolates the effect of the assignment under its design assumptions. See the paired Search study.
Weekly revenue and channel contributions
Weekly figures and predictive bounds
Which spending contrasts can distinguish the fits?
The shaded range shows overlapping effective exposure in the training data. At the same exposure in both channels the two fits give nearly the same combined revenue. Hold Social fixed and vary Search alone to see where the models diverge. The fitted shape outside training support relies heavily on modeling assumptions.
Violet curves use the lower Search prior. Amber curves use the higher prior. Dashes show Search’s contribution when Social stays fixed.
Curve comparison values
From prior predictions to later-week checks
- Simulate prior predictive revenue with the recorded exposures and demand. Would the prior generate plausible weekly sales and channel returns before observing outcomes?
- Use a likelihood for the training outcomes. Here the model is Gaussian with fixed transformations, so the analytic posterior also provides a reference for the sampler.
- Run four Hamiltonian Monte Carlo chains. Tune the step size during warmup, discard warmup, then retain joint draws. Investigate rank-normalized split R-hat above 1.01, low bulk or tail effective sample size, Monte Carlo error that matters for a decision, and divergences.
- Predict the later eight weeks using their real lag history, fixed training conventions and separate held-out outcomes. If preprocessing is estimated, fit it on training data alone. Hold out whole markets to check predictions for a new market.
A predictive check assesses how the model reproduces outcomes. Causal attribution also requires a defensible intervention comparison. Small prior-to-posterior moves can reflect compatible evidence or limited information. Refit plausible priors, controls or lag choices and check sensitivity where the decision will be made.
Share information across markets
View the combined Search amplitude in two markets under a local fit and under partial pooling. The local comparison fits its own baseline and demand terms and fixes Social to the shared mean. The pooled model estimates those terms jointly. Lower local precision and lower between-market variation generally pull a regional estimate closer to the shared mean.
For example, with a shared center of $8,000 and between-market SD of $1,150, the same $10,000 local estimate updates to about $9,784 at $400 SE and $8,429 at $2,200 SE. The wider local likelihood gives the shared center more weight.
Compare markets by differencing their policy effects within the same draw. State whether the answer gives markets equal weight, weights by population, or predicts a new market. See tested and untested markets in the calibration exercise.
The example stacks modeled channel contributions on a specified baseline. The bars change with the fitted model and the reference inputs.
When does removing Search recover its bar?
In this additive example each channel’s term is zero at zero effective exposure. Set Search to zero throughout the relevant lag history and evaluation weeks, with other inputs fixed. The drop in modeled revenue equals Search’s bar. Switching off spend today leaves carryover from earlier weeks.
A no-paid-media baseline can retain organic activity and promotions. An all-treatment baseline sets every treatment to its specified reference value. Attribute the gap to the inputs changed in that comparison. Interactions and mediated paths can make separate channel removals add up to a different number than joint removal. Compare a pause with the recorded schedule.
Select a channel to compare modeled revenue, average return, and marginal return along an illustrative response curve.
Illustrative response functions with hypothetical parameters; these are not fitted MMM estimates. Other channels remain visible as faint curves for comparison.
Compare two spending levels
The amber secant divides the revenue change by the signed spend change. The dark dashed tangent gives marginal ROAS at the current spend. Average ROAS divides incremental revenue by actual spend and is undefined at zero. For several markets or weeks, divide summed revenue by summed spend. An incremental revenue ROAS of 1 means revenue equals media cost. With a contribution margin of m and media as the only incremental cost, break-even is 1/m.
These illustrative curves are exponential. In the fitted tanh example, response is β tanh(A/s), with slope (β/s)[1 − tanh²(A/s)] in effective exposure A. The saturation scale s is $4,000. A marginal return in raw dollars also depends on cost, timing, adstock and the outcome window. Compare schedules using the fitted model.
If Search stops this week, which weeks of sales change?
Compare two Search schedules in one synthetic market, starting from the same spend history. Hold Social and demand fixed within each comparison. The charts share a week axis. Positive values mean the plan produces more than the reference. Blue is the plan, dashed gray is the reference, and violet shading marks training support.
Weekly spend, exposure and outcome values
How the guide combines uncertainty over time
For each joint posterior draw, sum the expected differences across the selected weeks, D = Σ(μ_plan − μ_reference). Take the interval and threshold probability from those totals. A multi-market decision also needs explicit market weights. Adding weekly interval endpoints discards posterior dependence.
A realized future revenue band adds outcome noise. An interval for a difference between two realized potential outcomes would also need a joint shock assumption. The expected-effect ribbon and total above use joint draws for the expected outcome.
What experiment would validate the effect of a four-week Search increase through two weeks of washout? Open the paired geo exercise.