PyMC-Marketing

A fully configurable Bayesian MMM you assemble yourself.

PyMC-Marketing isn't a fixed model the way Robyn and Meridian are — it's a kit you assemble: which decay curve, which saturation curve, which priors, which sampler settings. That flexibility is the point (and the tradeoff): if you don't have a specific reason to want that control, Robyn or Meridian will get you a result with far fewer decisions to make.

Connecting it

Drag a PyMC node off Period (or directly off Variables). The modal has two modes:

  • Guided — a form with the fields below. Recompiles into the model spec every time you save, so it's never out of sync with what you see.
  • Advanced — a raw JSON editor for the same spec, for when a setting you need isn't exposed as a guided field. meryn validates it before saving, so a malformed spec is rejected with an error rather than accepted and failing later during training.
The PyMC guided configuration modal
The PyMC guided configuration modal
Dragging a PyMC node onto the canvas

Adstock (carryover)

Field Default What it controls
Adstock kind Geometric The shape of how a channel's effect decays after spend stops. Geometric is a single-parameter exponential decay — the same family Robyn uses, and a reasonable default. Other options: Delayed (effect peaks after a lag rather than immediately), Weibull (CDF or PDF) (more flexible decay shapes, more parameters to fit), Binomial, or None (no carryover — same-period effect only).
Max lag 8 (range 1–52) The longest carryover window considered, in your data's time units.

Saturation (diminishing returns)

Field Default What it controls
Saturation kind Logistic The shape of how a channel's effect flattens out as spend increases. Other options: Hill / Hill (sigmoid), Michaelis-Menten, Tanh / Tanh (baselined), Root, Log, Inverse scaled logistic, or None. If you're not choosing this for a specific reason, Logistic is the safest default.
Link function Identity (additive) Whether channel effects add up (Identity) or multiply (Log). Switching to Log restricts Saturation to Log or None — the two have to be mathematically compatible.

Seasonality and time-varying effects

Field Default What it controls
Yearly seasonality 2 (0–10 Fourier modes) How much flexibility the model has to fit a recurring yearly pattern. Set to 0 to disable seasonality entirely.
Time-varying intercept Off Lets the baseline level drift smoothly over time instead of staying fixed. Meaningfully increases training time.
Time-varying media Off Lets each channel's coefficient drift over time instead of staying fixed for the whole period. Also increases training time — combined with a high draw count in Custom sampler settings, meryn will reject the combination as too slow to run in the time available.

Leave both time-varying options off unless you have a specific reason to believe the effect actually changed shape mid-period (a big pricing change, a channel mix shift) — they're the most expensive knobs in this modal.

Priors

Option What it means
Spend-informed (default, recommended) Sets each channel's starting belief in proportion to its share of total spend — a sensible, data-driven default with no manual input needed.
Default PyMC-Marketing's own out-of-the-box priors, with no adjustment for your data.
Custom A per-parameter editor if you have specific prior beliefs to encode.

Sampler settings

Preset Draws / Tune / Chains Target accept When to use it
Quick 500 / 500 / 2 0.90 Fast iteration while you're still deciding on the model structure — expect noisier convergence diagnostics.
Standard 1000 / 1000 / 4 0.90 The default balance of speed and reliability for most models.
Thorough 2000 / 2000 / 4 0.95 A final run once you're happy with the structure and want the most reliable result.
Custom You choose draws, tune, and chains (up to 4) individually, plus target accept (0.5–0.99) and the sampler (nutpie or pymc) When you need something between or beyond the presets.

Holdout validation

Field Default What it controls
Holdout validation Off Scores the model on data it didn't train on.
Holdout fraction 10% / 20% / 25% The final stretch of the date range, held out — the same "last block of dates" approach as Robyn, unlike Meridian's scattered holdout.

Calibration (optional)

Same lift-test mechanism as Robyn: add a channel, a date range, tested spend, and measured lift, and meryn validates the row against your actual spend data live. Two differences from Robyn's version: PyMC only calibrates paid channels (organic and contextual columns enter as covariates, not as something with a saturation curve to calibrate), and each lift-test row covers exactly one channel rather than letting you sum several into one test.

Reading convergence

PyMC results include a convergence verdict (converged / did not converge) based on standard Bayesian MCMC diagnostics — r-hat, effective sample size, and divergences. This is the one place across the three engines where meryn applies its own threshold rather than reading a verdict the framework provides directly (Meridian ships its own built-in reviewer; Robyn doesn't use MCMC at all, so the concept doesn't apply). Treat a "did not converge" result as a reason to increase draws/tune (try Thorough, or a Custom preset with a higher target accept) before trusting the model's numbers.

v1 scope: national data only

Geo-level modeling isn't available yet for PyMC — train on nationally aggregated data, same as the other two engines.

What connects here

Upstream: Period or Variables. Downstream: Budget allocator or Benchmark.