Chapter 06 of 10

Geography and the baseline

A non-centered geo hierarchy, a reference geo, and a knot spline deliberately coarser than the competition's.

A geo panel is the closest thing MMM has to replication: the same channels, the same period, many markets with different spend. That is where partial pooling earns its keep — a small market borrows strength from the national pattern instead of estimating its own ROI from noise.

beta[g,m] = exp(log_beta[m] + eta[m] * eps[g,m])

eta[m]    ~ HalfNormal(1.0)          # spread across geos
eps[g,m]  ~ Normal(0, 1)             # standardized offset

Why non-centered

Written the obvious way — sampling beta[g,m] directly from a distribution centred on the shared value with scale eta[m]— the geometry develops Neal’s funnel. When a geo carries little information, the posterior for its offset narrows as eta shrinks, and the sampler has to navigate a region whose curvature changes faster than a single step size can follow.

NUTS reports that as divergent transitions, which is the good outcome: the alternative is a sampler that quietly under-explores the funnel’s neck and returns a confidently wrong answer. Factoring the scale out of the sampled variable removes the pathology rather than diagnosing it.

source · engine/mmm/model.py

A reference geo

Geo 0’s intercept is fixed at zero and the rest are free. Free intercepts in every geo plus a free spline baseline is one redundant level of parameterization, and NUTS will happily wander along it forever — the likelihood is flat in that direction, so there is nothing to stop it.

The asymmetry between eta and xiis a modelling claim worth stating: a channel’s ROI varying wildly across markets is a much stronger assertion than a control’s coefficient doing so, so the media hierarchy is held tighter.

The baseline spline

The time-varying baseline is piecewise linear in knot coefficients. Each period puts weight on exactly the two knots bracketing it, inversely proportional to distance and summing to one, so a period landing on a knot gets weight 1 there. The coefficients are therefore directly interpretable as the baseline level at each knot rather than as basis-function loadings.

The baseline is shared across geos and shifted by tau[g]. Chapter 04 covers why the knot count is the identification decision that matters most.

One baseline shape for every market

Geos differ by a level, not a shape. A national retailer whose southern markets peak in winter and northern markets peak in summer is misspecified under this structure, and the misfit will land somewhere — most likely in the media terms, since they are the only other thing with geo-specific variation. If seasonality genuinely differs by market, carry it as a control column rather than expecting the shared spline to absorb it.