Marketing Mix Model
Operator: Abdulla Al Fahad. How tools are built and checked
Two things make marketing spend hard to read from sales. A TV burst keeps working for weeks after it airs, so this week's sales owe something to last month's spend, and each extra pound in a channel buys less than the one before. A marketing mix model gives each channel a decay for the first effect and a saturation curve for the second, and fits both with the base level of sales in one regression.
The honest caveat comes first, though: the model sees only correlation in your history. If two channels always moved together, no method can say which one did the work. The page therefore reports how far each answer moves across equally good settings, not just one number with an error bar.
Key features
- Geometric adstock over up to 12 lags and a logistic or Hill saturation per channel, scaled by each channel's own maximum spend
- A ridge regression with optional linear trend, 0 to 4 Fourier season pairs and up to 8 control columns such as price or promotions, with channel coefficients held non-negative
- Decay, saturation and ridge penalty chosen by coordinate search on expanding-window cross-validation, then a 200-refit block bootstrap for intervals
- Base and channel decomposition, ROAS, marginal ROAS, response curves, and a budget split that refuses totals beyond the spend range seen in the data
How adstock, saturation and ridge regression combine into one model
The table needs a sales (or conversions) column, one spend column per channel, and rows already in time order, one per week or day; a date column is optional and used only for labels. Control columns are numeric and are standardised before fitting. Every cell in the columns you use must be a number; spend cannot be negative, and a channel that spends the same amount every period is rejected because its effect cannot be told from the intercept.
For weekly data set the season length to 52.1775 rows, for daily data 365.25. At least 30 rows are needed and 2,000 are accepted; under about two years of weekly data a warning says that seasonality, trend and channel effects cannot be cleanly separated.
How it works
Each channel's spend is divided by its maximum, passed through a normalised geometric adstock (weights decay^0, decay^1 ... over the lags kept, summing to one; spend before the first row counts as zero), then through the saturation curve. Sales are scaled by their maximum, and the design matrix holds the intercept, optional trend and seasonality, standardised controls and the transformed channels.
Decay (0 to 0.9 in steps of 0.05), the saturation parameter and the ridge penalty are searched one channel at a time for up to four rounds and at most 6,000 fits, scored by the root-mean-square error of four forward-rolling test blocks over the last half of the data. The final fit uses all rows; a bootstrap of residual blocks of four rows refits at the chosen settings 200 times for the 90% intervals, and every setting within 2% of the best cross-validated error (up to 40) is refitted to show the range of ROAS they allow.
Common use cases
- The TV ROAS truth of 21.27 sits outside the 90% bootstrap interval (19.53 to 20.72) and inside the near-best range (20.23 to 21.52), which is the case for reading both columns: the bootstrap holds decay and saturation fixed, the range does not.
- Search has the higher marginal ROAS (14.65 against 13.31 for TV, per unit of extra spend at today's level), yet the optimiser finds only +2 sales a period from moving money towards it, with a 90% interval of -43 to +39. The page says the interval includes zero: this data does not show that the current split can be beaten.
- Asking for a weekly total above 31,794, the sum of the highest weekly spends in the data (19,854 for TV and 11,940 for search), is refused: the response curve is not evidence beyond what was spent.
- Refitting the same 156 weeks with the Hill curve instead of the logistic gives a TV ROAS of 23.11 and a search ROAS of 18.81, so the family of curve moves TV by almost three points, more than either interval allows for.
- Using only the first 52 weeks reverses the ranking, with TV at 19.16 and search at 22.61 against true values of 21.27 and 19.39; their near-best ranges, 18.2 to 21.2 and 19.8 to 24.8, overlap, and a warning flags the short history.
How to use this tool
- Drop the sales-and-spend table or load the simulated example, then pick the date, sales, channel and control columns.
- Choose the saturation curve, lags, season pairs and trend, and press Fit the model; it runs in the background and can be cancelled.
- Read the warnings and the channel table, then the decomposition and response curves.
- Try a budget split inside the observed range, and download the decomposition or the workbook.
Example
156 simulated weeks of sales with TV and search spend, generated from known values: decay 0.4 and 0.2, logistic lambda 4 and 3, coefficients 3 and 2, intercept 2, noise 0.25 (sales scaled by 100,000)
week,sales,tv_spend,search_spend
2023-01-02,...What the fit returns against what generated the data
TV: decay 0.45 (true 0.40), saturation 3 (true 4), ROAS 20.29 (true 21.27), 90% interval 19.53 to 20.72, near-best range 20.23 to 21.52
Search: decay 0.30 (true 0.20), saturation 2 (true 3), ROAS 18.78 (true 19.39), interval 17.70 to 19.50, range 15.68 to 20.31
Share of sales: TV 34.3% (true 36.0%), search 18.6% (true 19.2%), base 47.0% (true 44.8%)
R squared 0.961; 1,997 settings triedTips for best results
- Compare the near-best ROAS range with the bootstrap interval before quoting a number; if the range is much wider, the settings, not the noise, are the uncertainty.
- Add controls for known price changes, promotions and holidays before reading channel effects; omitted drivers get absorbed by whatever channel moves with them.
- Fit the same data with the Hill curve as well and see whether the ranking of channels changes.
- Use a response curve to see where a channel flattens before trusting its marginal ROAS.
Common pitfalls
Correlated spend cannot be separated. The page warns when channel spend correlation passes 0.6 and when a spend VIF passes 5.
Intervals come from refits at the chosen decay, saturation and penalty, so they understate the uncertainty about those choices.
Residual autocorrelation (a Durbin-Watson far from 2) means the intervals are too narrow; a warning appears when it is more than 0.7 away.
Spend before the first row counts as zero, so the first few weeks of adstock are understated.
A negative channel coefficient is held at zero and reported, which can hide a real but offsetting effect.
Only geometric adstock is available; delayed-peak (Weibull) adstock and Bayesian priors are not.
Common errors and how to fix them
- "Channel X has a negative, missing or non-numeric spend"
- Fill or remove blank weeks and strip currency symbols or footnote text from the numeric columns.
- "The total is above what the observed spend range allows"
- Lower the total, or raise each channel's allowed percentage only up to the highest weekly spend in your data.
Best practices
- Calibrate against a geo or lift experiment when you have one, and treat the model as a way to place the experiment's result in context.
- Keep the model choices fixed between refreshes so changes in ROAS reflect new data, not new settings.
- Report ROAS with its range, not as a single figure.
- Never move a budget by more than the range the data covers.
Frequently asked questions
Why do the recovered decay and saturation not match the true values exactly?
Decay and saturation trade off: a slower decay with a steeper curve can produce nearly the same fitted sales as a faster decay with a flatter one. 40 settings scored within 2% of the best error in the example, which is why the page shows the range.
Is this a causal estimate of what each channel did?
No. It is a regression on history. It describes what the data are consistent with, given the controls and the form of the curves. Experiments are the check on causality.
How are the simulated numbers generated?
From the stated decays, lambdas, coefficients, intercept and noise, with bursty weekly spend drawn from a fixed seed. The page prints the true values beside the example so you can compare, and says plainly that the data are generated, not measured.
Why is the optimiser sometimes so unimpressed?
If the current split is already close to where marginal returns equalise, moving money gains almost nothing, and the bootstrap shows the gain could be negative. The page reports that rather than a hopeful figure.