AI-driven Media Mix Modeling: Optimize Budget with Bayesian MMM

When classic last-click attribution stops working due to cookie-tracking restrictions, marketing budgets are allocated blindly. We develop AI media-mix modeling that assesses each channel's real contribution, accounting for delayed effects and saturation. Our team delivers the project turnkey—from data audit to implementation and support—ensuring a reliable solution that scales with your business.

AI Development Areas

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1344
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1306
  • B2B Advance company logo design
    B2B Advance company logo design
    753
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1049
  • AIDER company logo development
    AIDER company logo development
    992
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1097

How AI-driven Media Mix Modeling Optimizes Budget?

With the decline of cookie tracking and stricter GDPR, last-click attribution has lost relevance. Media Mix Modeling (MMM) returns as a privacy-safe method to evaluate each marketing channel's contribution. We help companies build MMM models that account for adstock (delayed effect), saturation (diminishing returns), and multicollinearity. Our experience: 5+ years, 30+ projects in retail, fintech, and e-commerce. In one retail project, we reduced CPA by 18% by reallocating budget from TV to digital based on MMM. Typical budget savings are 15-25%, and in one case savings exceeded $300K per year. According to Nielsen, MMM can deliver ROI 3-5 times higher than last-click attribution. We will assess your project in 1-2 days.

Media Mix Modeling: Definition and Necessity

MMM is an econometric approach where regression (often Bayesian) estimates the dependence of sales on advertising spend per channel, considering seasonality and external factors. The main advantage is working with aggregated data, no user tracking. But complexities arise: advertising is not instantaneous (carry-over) and has diminishing effectiveness (diminishing returns). Read more about Media Mix Modeling.

Why Adstock and Saturation Are Critical for Accuracy?

Adstock transformation models the delayed effect. Typical implementations: geometric weighting (one decay parameter) and Weibull distribution (flexible shape—peak can be delayed). Without adstock, the model underestimates channels with long cycles (TV, radio). Saturation is described by the Hill function: spend^alpha / (gamma^alpha + spend^alpha). Parameter gamma is the half-saturation point, alpha is curve steepness. Without saturation, the model would wrongly recommend infinite investment in the most effective channel.

Code for adstock transformation:

def adstock_transform(spend_series, decay_rate=0.3, lag=None):
    """ Adstock: each point = spend + decay × previous adstock
    decay_rate: 0 = no memory, 0.9 = long memory """
    adstock = np.zeros(len(spend_series))
    adstock[0] = spend_series[0]
    for t in range(1, len(spend_series)):
        adstock[t] = spend_series[t] + decay_rate * adstock[t-1]
    return adstock

def weibull_adstock(spend, shape=2.0, scale=4.0, max_lag=13):
    """ Weibull PDF: flexible distribution shape of delayed effect
    shape < 1: decreasing (instant impact)
    shape > 1: delayed peak (advertising accumulates) """
    pdf = scipy.stats.weibull_min.pdf(np.arange(max_lag), shape, scale=scale)
    pdf = pdf / pdf.sum()
    return np.convolve(spend, pdf, mode='full')[:len(spend)]

How Bayesian MMM Solves Multicollinearity Issues?

Classical linear regression suffers from multicollinearity—when channels are correlated over time (e.g., TV and digital launched simultaneously). Bayesian approach (PyMC, Stan) addresses this via informative priors and regularization. A Bayesian model is 3 times more accurate than OLS under high multicollinearity.

import pymc as pm
import numpy as np

with pm.Model() as mmm_model:
    # Priors for each channel's parameters
    beta_tv = pm.HalfNormal('beta_tv', sigma=1.0)
    beta_digital = pm.HalfNormal('beta_digital', sigma=1.0)
    beta_search = pm.HalfNormal('beta_search', sigma=1.0)

    # Decay priors (0-1)
    decay_tv = pm.Beta('decay_tv', alpha=3, beta=3)
    decay_digital = pm.Beta('decay_digital', alpha=2, beta=5)

    # Saturation priors
    gamma_tv = pm.HalfNormal('gamma_tv', sigma=0.5)

    # Transformed media
    tv_adstock = adstock_transform(tv_spend, decay_tv)
    tv_saturated = hill_saturation(tv_adstock, gamma=gamma_tv)

    # Baseline and trends
    trend = pm.Deterministic('trend', np.arange(len(y)))
    seasonality = pm.Deterministic('seasonality', fourier_features(n_harmonics=4))
    intercept = pm.Normal('intercept', mu=y.mean(), sigma=y.std())

    # Model
    mu = (intercept + beta_tv * tv_saturated + beta_digital * digital_saturated + beta_search * search_saturated + trend_coef * trend + seasonality_coefs @ seasonality)
    sigma = pm.HalfNormal('sigma', sigma=y.std() * 0.2)
    y_obs = pm.Normal('y_obs', mu=mu, sigma=sigma, observed=y)

    trace = pm.sample(2000, tune=1000, target_accept=0.95)

Posterior distributions give confidence intervals for each channel's contribution, not point estimates. This is critical when making budget reallocation decisions.

How to Estimate ROI per Channel with MMM?

After building the model, we calculate marginal ROI for each channel: the point where further investment yields less return than cost. For example, if marginal ROI for TV is 1.2 and for digital 2.5, optimal reallocation is clear. The Bayesian approach provides a distribution of marginal ROI, not a single number, reducing the risk of wrong decisions.

MMM Building Process: From Data to Budget Optimization

  1. Data collection and aggregation (spend, sales, external factors) — 1-2 weeks.
  2. Adstock and saturation transformations — tuning functional forms.
  3. Building Bayesian model — selecting priors, MCMC sampling, convergence diagnostics (R-hat < 1.01).
  4. In-sample and out-of-sample validation — MAPE on holdout < 10% is considered good.
  5. Calibration via geo-experiments — changing budget in a test region to verify effects.
  6. Budget optimization — maximizing total lift under budget constraint (scipy.optimize).

Comparison of Approaches

Approach Advantages Disadvantages
OLS Simplicity, interpretability Sensitive to multicollinearity, no uncertainty
Bayesian (PyMC) Confidence intervals, robustness, priors Computationally heavier, requires prior tuning
Robyn (Meta) Automation, grid search, Pareto front Less flexibility, closed framework

We use a hybrid approach: Bayesian model for understanding effects, Robyn for fast scenario analysis.

What's Included in Our Service

  • Data audit and preparation (cleaning, aggregation, outlier handling).
  • Building a Bayesian MMM model customized to business context.
  • Integration of Robyn for automated hyperparameter selection.
  • Budget optimization with marginal ROI calculation (point where ROI = 1).
  • Visualization of contributions and scenarios (shiny/dash dashboard).
  • Model documentation and team training (2-3 workshops).
  • Support during geo-experiments and recalibration (3 months post-deployment).

Timeline and Implementation Stages

Stage Duration
Data analytics and adstock/saturation setup 2-3 weeks
Bayesian model and validation 2-3 weeks
Budget optimizer and dashboard 1-2 weeks
Geo-calibration and final report 2-4 weeks
Total: baseline solution 4-6 weeks
Full cycle (with Robyn and experiments) 2-3 months

Why Clients Choose Us

  • Experience: team with 5+ years in MMM, 30+ projects in retail and fintech.
  • Technology: PyMC, Robyn, Bayesian priors from business — not a black box.
  • Guarantee: MAPE on holdout < 10% or rework at our cost.
  • Support: team training, documentation, assistance in geo-experiments.

Contact us for a project assessment. We'll prepare a commercial proposal and roadmap within 2 days. Request a consultation and get an analysis of your data within one business day.