MMM: Models
Notation and core mathematical specification
Let:
- index time;
- index geography;
- index a resolved media node;
- map media node to a parent pooling group;
- index a control variable;
- be the modeled outcome;
- be raw media execution or exposure;
- be media spend;
- be a control value;
- be profit or business value per modeled KPI unit;
- be the observation mask.
Leakage-safe preprocessing
For media node , the exposure scale is the median positive exposure in the fitting data:
Typical media exposure equals the middle positive exposure in the fitting data. Scaled exposure equals raw exposure divided by that typical exposure.
Terms: is the typical positive exposure for media node ; is raw exposure at time , geography , and media node ; marks observations included in fitting; is scaled exposure.
Controls use fitting-period means and standard deviations:
Standardized control equals the control value minus its fitting-period average, divided by its fitting-period standard deviation.
Terms: is the standardized control; is the raw control value; is its fitting-period mean; is its fitting-period standard deviation; identifies the control.
The additive outcome is standardized with fitting-period location and scale :
Standardized outcome equals the observed outcome minus its fitting-period average, divided by its fitting-period standard deviation.
Terms: is the standardized outcome; is the observed outcome; is the fitting-period mean outcome; is its fitting-period standard deviation.
All preprocessing statistics are learned only from the active fitting mask. A final evaluation refit uses train plus validation and continues to exclude the locked test. An approved production refit can use all available history.
Baseline predictor
The shared scaled baseline is
Baseline demand equals the overall level plus geography and time effects plus the combined effects of all controls.
Terms: is scaled baseline demand; is the global intercept; is the geography offset; is the time-related baseline effect; is control 's coefficient; is its standardized value; is the number of controls.
where is the global intercept, is a partially pooled geography offset, is the selected trend, seasonality, or dynamic baseline contribution, and is a control coefficient.
Transformed media response
For each media node, the model constructs
Transformed media response equals scaled exposure after carryover, diminishing returns, and any approved constrained correction.
Terms: is the transformed media response; is the adstock or carryover function; is the saturation function; is the identity or constrained neural correction; maps node to its parent group; is the scaled exposure history.
where is adstock, is saturation, and is either the identity mapping or the constrained neural correction. Parameters may be fixed or estimated and can be scoped to each media node or its parent group as allowed by the specification.
Additive outcome model
The expected outcome in original modeled-KPI units is
Expected outcome equals restored baseline demand plus the contribution from every media node.
Terms: is the expected outcome; restores the baseline to outcome units; is media node 's effect coefficient; is the transformed response; is the number of media nodes.
Equivalently, on the standardized likelihood scale:
Standardized expected outcome equals scaled baseline plus media contributions expressed in standardized outcome units.
Terms: is the standardized expected outcome; is the scaled baseline; is the outcome standard deviation; is media node 's contribution in outcome units.
Media contributions add exactly to total media lift:
A node's contribution equals its effect times its transformed response. Total media lift is the sum of all node contributions.
Terms: is the contribution from media node ; is its effect coefficient; is its transformed response; is the total media contribution.
Multiplicative log-link outcome model
The multiplicative form requires positive fitting outcomes. It builds a business baseline on the log scale:
Log baseline equals the restored scaled baseline. A media node's log lift equals its effect times its transformed response.
Terms: is the log baseline; and are the fitting-period mean and standard deviation of the log outcome; is the scaled baseline; is node 's log lift; and are its effect and transformed response.
Total expected log outcome equals log baseline plus all media log lifts.
Terms: is the total expected log outcome; is the log baseline; is media node 's log lift.
With ordinary LogNormal noise, the response-scale posterior mean is
Expected outcome equals the exponentiated log prediction with a correction for log-scale noise.
Terms: is the expected outcome given model parameters ; is the expected log outcome; is the log-scale observation noise.
Thus media acts as a positive proportional lift over a baseline rather than as an additive number of outcome units.
Media response modeling
The model never applies a coefficient directly to raw spend. Raw execution is first scaled, carried through time, and saturated. A media coefficient therefore operates on transformed media pressure.
The pipeline for node is:
- scale execution by its train-only typical positive level;
- apply a causal finite-lag adstock kernel;
- apply a bounded, zero-anchored saturation curve;
- optionally blend the curve with a monotone, concave neural response;
- multiply by an additive outcome-unit coefficient or a multiplicative log-effect coefficient.
Execution and spend have distinct roles. Execution identifies response shape and timing; spend is the denominator in ROI and, in the additive form, participates in the business-scale ROI parameterization.

Adstock, retention, and half-life
Adstock encodes the fact that media pressure can persist after execution.
Geometric adstock
For retention and maximum lag , normalized weights are
Each lag receives a decaying carryover weight, and all lag weights are divided by their total so they sum to one.
Terms: is media node 's weight at lag ; is retention; is the maximum lag; indexes all included lags.
The carried exposure is
Adstocked exposure is the weighted sum of current and previous scaled exposures.
Terms: is adstocked exposure; is the weight at lag ; is scaled exposure periods earlier.
with unavailable pre-history treated as zero. Normalization keeps a constant input on a comparable scale across retention settings.
The half-life , in model periods, is related to retention by
Retention is chosen so that the remaining media effect falls to one half after the stated half-life.
Terms: is per-period retention for media node ; is its effect half-life measured in model periods.
with when the configured half-life is zero. Retention can also be configured directly; a direct retention specification takes precedence.
Weibull adstock
Weibull adstock supports a delayed peak. For shape and scale , define survival at lag as
Remaining carryover at a lag is an exponential decay whose timing is controlled by Weibull scale and shape.
Terms: is the remaining carryover at lag ; is Weibull shape; is Weibull scale; identifies the media node.
Unnormalized lag mass is
The effect assigned to a lag equals the drop in remaining carryover from that lag to the next.
Terms: is unnormalized effect mass at lag ; and are remaining carryover at consecutive lags.
and the finite-lag weights normalize over . The same causal convolution used for geometric adstock then produces .
Configuration and estimation
The default maximum lag is 8 periods. Adstock parameters can be fixed or given priors, and can be estimated at media-node or parent-group scope. Default prior settings include a 2-period geometric half-life median, Weibull shape median 1.5, and Weibull scale median 3. These are prior centers, not hard-coded fitted values.

Saturation and diminishing returns
Saturation maps non-negative adstocked pressure to a bounded response. Every implemented family starts at zero. The discrete family is selected in the model specification and compared across candidates outside NUTS.
Weibull-CDF saturation
The default is
Saturated response equals one minus the remaining unrealized response; exposure is measured relative to the half-response point and curved by the shape parameter.
Terms: is the response between zero and one; is adstocked exposure; is the 50% response point; controls curve shape; prevents negative exposure.
where is exactly the 50% response point and controls shape:
At exposure equal to the half-response point, the modeled response is exactly 50% of its ceiling.
Terms: is the saturated response; is the 50% response exposure; is the curve-shape parameter; 0.5 means half of maximum response.
The default prior medians are typical exposure and .
Anchored logistic saturation
Let midpoint , slope , and
The anchor value is the ordinary logistic response at zero exposure.
Terms: is the zero-exposure anchor; is the logistic midpoint; is the slope; is the exponential function.
The zero-anchored logistic response is
Start with the logistic response, subtract its zero-exposure value, and rescale it so response begins at zero and approaches one.
Terms: is the zero-anchored response; is adstocked exposure; is the midpoint; is the slope; is the zero-exposure anchor.
Subtracting and rescaling by makes .

Constrained neural response layer
The neural component is a small shape-constrained correction to the parametric saturation response. It is not an unrestricted residual network and does not bypass the Bayesian model.
Let be the selected parametric saturation response for a parent media group. For neural unit , define
Each neural basis converts the parametric response into a smooth increasing curve that starts at zero and is normalized to one.
Terms: is the basis-unit response; is the parametric saturation response; is the unit bias; is a positive unit slope; softplus is a smooth positive transformation.
where . Each basis is zero-anchored, normalized at one, monotone, and concave. The neural curve is
The neural curve is a weighted average of all basis curves, with positive weights that sum to one.
Terms: is the combined neural curve; is the number of units; is unit 's basis response; is its normalized weight; is the raw weight vector.
The final transformed response is a shrinkage blend:
Final response blends the original parametric curve with the neural correction; the blend weight controls how much correction is allowed.
Terms: is the final corrected response; is the original parametric response; is the neural curve; is the blend weight from zero to one.
The default has two units and , strongly favoring the parametric curve unless the likelihood supports a correction. Weight logits and raw slopes use Normal(0, 0.5) priors; biases use Normal(0, 1). One weight logit is fixed as a reference for identifiability.
All non-fixed neural parameters are sampled jointly by NUTS. Their posterior uncertainty therefore propagates into media response, contributions, ROI, and predictions. Setting use_neural_correction=False makes .
Additive versus multiplicative specification
| Property | Additive | Multiplicative log-link |
|---|---|---|
| Outcome support | Real-valued outcome scale | Strictly positive fitting outcome |
| Media effect | Outcome-unit increment | Positive proportional lift |
| Likelihood | Student-t on standardized outcome | LogNormal or contaminated LogNormal |
| Primary media prior | Business-scale ROI | Positive transformed-media coefficient |
| Node contribution | Full prediction minus channel-removal counterfactual | |
| Decomposition additivity | Exact | Requires separate conserving allocation |
| Baseline dependence | Same absolute lift at same response | Lift grows with baseline level |
Multiplicative counterfactual contribution
Let
Full prediction is the model's expected outcome with all variables included.
Terms: is the full expected prediction; is the outcome; represents all fitted model parameters.
and let be the expected prediction after removing while holding all other posterior values fixed. Then
A media node's removal contribution is full prediction minus the prediction with that node removed.
Terms: is the counterfactual contribution; is the full prediction; is the prediction with media node removed.
Individual removal effects overlap under a log link, so they do not sum exactly to the total lift. For decomposition charts, the implementation also emits a conserving allocation:
Total media lift is divided among nodes in proportion to each node's log lift so allocated contributions add back to total lift.
Terms: is the conserving allocated contribution; is the full prediction; is the baseline-only prediction; is node 's log lift; indexes all media nodes.
with a safe zero-effect convention. Counterfactual contribution is used for causal removal and ROI interpretation; conserving contribution is used where components must reconcile exactly to the predicted total.
Model form is an explicit candidate choice. Eligibility checks prevent use of the multiplicative form when its positive-outcome assumptions are not met.
Controls, external variables, and baseline
Controls are generic numeric variables supplied by the client. Price, promotion, distribution, holidays, macroeconomic factors, competitor activity, and supply variables are supported when they are mapped to controls at the model's time and geography grain. The model does not infer business semantics from the coefficient alone; semantic classification occurs during ingestion.
Baseline families
- Linear: global intercept, centered geography offset, and linear trend.
- Piecewise linear: linear trend plus equally spaced hinge bases. Hinge features are orthogonalized against intercept and trend and standardized on fitting periods.
- Recent level: adds an indicator beginning at a configured fraction of the fitting window.
- Dynamic AR(1): adds a recursively evolving latent state with bounded persistence and estimated innovation scale. The state is centered on fitting periods.
- Local linear trend: recursively evolves level and slope innovations and orthogonalizes the result against intercept and linear trend.
Optional Fourier seasonality adds sine and cosine terms. The default seasonal period is 52 and the default number of harmonics is zero, so seasonality is enabled only when requested by the selected specification.
Holiday flags and similar controls are not special likelihood terms. They enter through standardized control columns. For additive models their effects are outcome-unit components after reversing target scaling. For multiplicative models they modify the log baseline and are reported through response-scale counterfactual removal.
Hierarchical and multi-level modeling
The implementation uses two distinct hierarchies.
Geography baseline hierarchy
For , raw geography offsets use a non-centered parameterization:
Each geography starts with a standard-normal raw deviation, while a separate positive scale controls how different geographies may be.
Terms: is geography 's raw deviation; is the common geography variation scale; 0 and 1 are the standard-normal mean and scale; 0.5 is the prior scale for geography variation.
Final geography effect equals the common variation scale times that geography's raw deviation after removing the average raw deviation.
Terms: is the centered geography effect; is the geography variation scale; is the raw geography deviation; is the number of geographies; indexes all geographies.
One raw reference element is fixed before centering. This separates the global level from geography deviations and partially pools low-information regions. For a single geography, the deviation is zero.
Media-node hierarchy
The model is dimension-name agnostic. A media node may represent a channel, vehicle, campaign, creative, or another ingested entity. Every node maps to a parent pooling group. Transform parameters may be shared at parent-group scope or estimated at media-node scope. Media effects use group shifts plus weighted node deviations.
An identification analysis assigns each node one of these operational states:
- individually estimable;
- estimable with partial pooling;
- group only;
- unsupported.
The analysis uses active-period coverage, number of active periods, coefficient of variation, unique positive values, pairwise correlation, variance inflation factor, and spend support. Default warning thresholds include 5% active fraction, 6 active periods, 0.05 coefficient of variation, 0.95 pairwise correlation, VIF 10, and 3 unique positive values. Pooling begins earlier at correlation 0.80 or VIF 5 and can reduce the node deviation weight as low as 0.25 before moving to group-only attribution.
Product, retailer, or other business dimensions are supported when ingestion represents them in the canonical panel or media-node mapping. They are not separate hard-coded latent axes in the current model.
