Beacon Light

Building a marketing mix model

Marketing mix modelling explains one number — sales, orders, sign-ups — using everything that plausibly moved it: media spend, price, distribution, promotions and seasonality. This guide walks the workflow in the order the app presents it, and explains what each step is for.

You do not need to read it first. The same advice appears above each screen as you work.

Step 1Data

Load the data

Get a clean weekly history in front of the model: one row per period, a date column, the KPI, and a column per driver.

A mix model is a regression, and like any regression it is only as good as the history you hand it. Everything downstream — the ROIs, the optimiser, the forecast — inherits whatever is wrong with the data at this step.

Weekly data is the usual cadence. Daily data is noisier and makes adstock harder to identify; monthly data rarely has enough observations to support many drivers. Two to three years is the common sweet spot.

Everything is read by your own browser. The file is never uploaded, which is also why the first load spends a moment fetching the Python runtime — and why uploads are capped at 50 MB so the tab stays within Wasm memory.

What to do

  • Pick a sample dataset, or drop in your own CSV or Excel file.
  • Check the KPI has been guessed correctly, and set a panel dimension if the data is split by store or market.
  • Read the validation notes — gaps, duplicated dates and constant columns all cause trouble later.

What to watch for

  • Two or more years of weekly history. Less than that and seasonality and media effects start competing for the same evidence.
  • No long runs of zeroes in a channel you intend to model. A channel that barely ran cannot be measured.

Step 2Explore

Look before you model

Understand each driver and how it relates to the KPI, so the model specification is a considered choice rather than a guess.

Media does not work instantly and it does not work forever. Adstock carries a portion of this week's spend into following weeks, decaying geometrically; the half-life is the number of periods until half the effect has faded. Television usually carries further than paid search.

Saturation captures diminishing returns: the tenth thousand pounds into a channel buys less than the first. Without it, the optimiser will happily recommend infinite spend.

The point of this screen is that both of those are assumptions you are making about the world, and it is better to look at the data before you make them.

What to do

  • Plot the KPI and look for the trend, the seasonal shape and any obvious one-off events.
  • Check the correlation heatmap for pairs above |r| = 0.7 — a regression struggles to tell those apart.
  • Use the scatter view against the KPI to see whether a channel already looks saturated.
  • Build a transform in the feature builder and watch the live preview.

What to watch for

  • A curved cloud in the scatter is the visual signature of diminishing returns; a straight one suggests the channel has not yet saturated.
  • Two channels that always ran together will not separate, however the model is specified. Consider combining them.

Step 3Model

Specify and fit

Choose the KPI, pick the drivers, state what you already believe about them, and let the data answer.

Beacon Light fits a conjugate Bayesian regression by default. A prior is what you believe about a coefficient before the data speaks; the posterior is what is left after the data has had its say. Conjugate updating solves for that in closed form, which is why it returns in milliseconds rather than the minutes a sampler would take.

This matters most where the data is weakest. A channel that only ran in four weeks, or one that moved in lockstep with another, carries very little information — least squares will still hand you a confident-looking number, whereas a posterior will show a wide interval and tell you the truth.

Priors can be stated in coefficient units, as an ROI, or as a share of the KPI. ROI is usually the easiest to reason about: saying you expect roughly £1 back per £1 spent, give or take, is a claim a marketer can actually hold an opinion on.

Least squares remains available on the Method tab, and is a useful sanity check. If the two approaches disagree sharply, the priors are doing the work rather than the data.

What to do

  • On Setup, confirm the KPI and add Fourier terms if the series has a clear seasonal shape.
  • On Variables, toggle drivers in and out. Media spend usually wants adstock and saturation; controls usually do not.
  • Set a prior for each coefficient and read the posterior next to it. Leave the prior on Auto where you have no view.
  • Use Observations to hold out a recent window if you want an honest test of the fit.

What to watch for

  • A credible interval spanning zero means the data has not settled even the sign of the effect.
  • VIF above 10 means the coefficient should not be read on its own, whatever its interval says.
  • A posterior sitting exactly on top of its prior means the data said nothing and you are reading your own assumption back.

Step 4Outputs

Read the results

Find out what the model thinks each driver delivered, and whether it tracked what actually happened.

Contribution is the KPI a driver delivered, which is the coefficient multiplied by the driver's value in that period. ROI divides that by what was spent. Both inherit all of the model's uncertainty, which is why the intervals matter.

The base — the intercept plus anything not explicitly modelled — is often the largest single band. A base that swallows most of the KPI is a sign that drivers are missing, not that marketing does nothing.

What to do

  • Start on Model fit: persistent gaps in one stretch usually mean a driver is missing for that period.
  • Look at the contribution decomposition to see what each driver delivered in each period.
  • Check ROI by channel, and the response curves that sit behind it.
  • Read the coefficient table with its credible intervals.

What to watch for

  • A channel with a large contribution but a wide interval is a number you should not put in a board deck without a caveat.
  • Contributions that swing wildly period to period usually mean the transforms are wrong rather than the world being strange.

Step 5Scorecard

Check it honestly

A model can fit well and still be unusable. This is the step that tells you which one you have.

R² measures how much of the KPI the model reproduces, and it is easy to inflate by adding variables. It says almost nothing about whether the individual channel effects can be trusted, which is the number anyone actually wants to use.

The scorecard grades fit, residual behaviour, collinearity, coefficient sanity, contribution plausibility, transform shape and data sufficiency separately, so a model that is good at one and bad at another cannot hide behind a single figure.

What to do

  • Run the scorecard and read the failures before the score.
  • Work through collinearity and coefficient-sanity warnings first — they are the ones that make channel-level numbers untrustworthy.
  • Go back to Model and change the specification, rather than tuning until the score improves.

What to watch for

  • Residual autocorrelation means something time-varying is missing; the coefficients are absorbing it.
  • A wrong-signed coefficient on a well-understood driver is a specification problem, not a finding.

Step 6Scenario

Plan the budget

Use the fitted response curves to work out where the next pound should go.

The optimiser equalises marginal returns: at the best allocation, the next pound buys the same amount of KPI whichever channel it goes into. That is a property of the fitted curves, so it is exactly as reliable as they are.

What to do

  • Move spend between channels by hand and watch the modelled KPI respond.
  • Run the optimiser to allocate a fixed budget, then compare it against the plan you had.
  • Look at the efficient frontier to see what more or less budget would buy.

What to watch for

  • The optimiser only knows what the model knows. A channel with a wide credible interval will be allocated on a number that might be wrong.
  • Recommendations far outside the spend range in the history are extrapolation, not measurement.

Step 7Forecast

Project forward

Run the model into the future under a spend plan you specify.

A forecast from a mix model is a conditional statement: given this spend plan, and given the relationships the model found, this is the expected KPI. It is most useful for comparing plans against each other rather than as a point prediction.

What to do

  • Set the horizon and how each driver should be seeded — held flat, repeated from last year, or overridden.
  • Read the KPI forecast alongside the contribution stack that produces it.

What to watch for

  • The forecast assumes the relationships hold. A market that has changed shape will not be predicted by a model fitted before it changed.

A short glossary

Adstock
The carry-over of media into later periods. A half-life of two weeks means half the effect has faded after two weeks. Television usually carries further than paid search.
Saturation
Diminishing returns within a period: the tenth thousand pounds buys less than the first. Without it, an optimiser will recommend spending without limit.
Prior
What you believe about a coefficient before the data speaks. Leaving it on Auto uses a weakly informative default scaled to the KPI, which lets the data decide almost everything.
Posterior
What is left of that belief once the data has had its say. A posterior that has barely moved off its prior means the data had little to contribute for that variable.
Credible interval (HDI)
The narrowest range holding a given share of the posterior — 94% by default. If it spans zero, the data has not settled even the direction of the effect.
Contribution
The KPI a driver delivered in a period: its coefficient multiplied by its value. The contributions plus the base add up to the modelled KPI.
Base
Everything the model does not explain with a named driver, including the intercept. A base that swallows most of the KPI usually means drivers are missing.
VIF
Variance inflation. Above 10, a variable is so correlated with the others that its individual coefficient should not be read on its own.
Holdout
A stretch of history excluded from fitting and kept back to test the model against periods it has never seen.

Ready to try it

The sample datasets run the whole workflow end to end on the free plan, including saving and reopening your work.

Open the workspace