Bayesian Methods for Media Mix Modeling with Carryover and Shape Effects (Jin et al., 2017), explained

The Google paper behind the delayed adstock, Hill saturation and ROAS definitions in LightweightMMM and Meridian, with the transforms rebuilt so you can try them, and what its simulations say about how much data you need.

Mike Taylor By Mike Taylor · Updated · 12 min read

“Bayesian Methods for Media Mix Modeling with Carryover and Shape Effects” is a 2017 Google paper by Yuxue Jin, Yueqing Wang, Yunting Sun, David Chan and Jim Koehler that proposed the model most open-source MMMs now use: a delayed adstock for carryover, a Hill curve for diminishing returns, and Bayesian estimation so that prior knowledge can fill gaps in thin data. Its most important finding is less often quoted: with the typical two years of weekly national data, the model’s response curves came out biased and the priors did much of the work.

I’ve taught this model for years, first in the Vexpower path that walked people from Excel to LightweightMMM and now in the MMM course, and I think the paper is far more useful than its reputation as “the Google formula” suggests. Most people take the equations and skip the simulations, which is a shame, because the simulations are where the authors explain when you shouldn’t trust the output. This page goes through the model, rebuilds the transforms so you can play with them, and then covers what the paper found about data, priors and bias, and why it still shapes Google Meridian.

Why Google needed Bayesian methods for media mix modeling with carryover and shape effects

The starting point is that the textbook MMM, a linear regression of sales on spend, can’t represent two things everyone believes about advertising. It assumes the next dollar is worth exactly as much as the last (no saturation, which the paper calls the “shape effect”), and it assumes ads only work in the week they run (no lag, the “carryover effect”). Both can be patched with transformations, but once the transformations have parameters you estimate, the model is no longer linear in its parameters and ordinary least squares stops being enough.

The authors chose a Bayesian approach for two reasons. It handles the nonlinear parameters through Markov chain Monte Carlo sampling, and it lets you bring in information from outside the dataset (industry experience, or previous models for similar brands) as prior distributions. They lean on their colleagues Chan and Perry for the reason that matters: a single MMM dataset carries very little information relative to the number of parameters it’s asked to estimate, so the model needs help from somewhere. You can read that argument in full on our page about Chan and Perry’s challenges paper.

It’s worth noting what the paper deliberately doesn’t do. The authors say plainly that they don’t address the causal problems Chan and Perry raise, such as selection bias from ad targeting, and focus on the model and its estimation instead. So this is a paper about getting a flexible model to fit honestly, not about proving that what it measures is caused by the ads, which is a distinction a lot of vendor decks blur.

The model: delayed adstock with a peak, then a Hill curve

The carryover part is a weighted average of the current week’s spend and the previous L−1L - 1 weeks. For channel mm in week tt, with a nonnegative weight function wmw_m:

adstock(xt−L+1,m,…,xt,m;wm,L)=∑l=0L−1wm(l) xt−l,m∑l=0L−1wm(l)\text{adstock}(x_{t-L+1,m}, \dots, x_{t,m}; w_m, L) = \frac{\sum_{l=0}^{L-1} w_m(l)\, x_{t-l,m}}{\sum_{l=0}^{L-1} w_m(l)}

Because the weights are normalized, a channel that spends the same amount every week has an adstocked value equal to that amount; carryover only reshapes spend in time, it doesn’t inflate it. The paper offers two weight functions. Geometric adstock, w(l)=αlw(l) = \alpha^l, assumes the effect peaks in the week of spend and decays at retention rate α\alpha, which is the classic adstock idea. The new one is delayed adstock, w(l)=α(l−θ)2w(l) = \alpha^{(l-\theta)^2}, where θ\theta is the delay to the peak. It’s proportional to a normal density centered on θ\theta, so the effect builds up, peaks after θ\theta weeks and then fades, which suits media like TV that take a while to show up in sales. The authors set L=13L = 13 weeks in both the simulations and the real example.

The shape part is the Hill function, borrowed from pharmacology, applied to the adstocked spend and multiplied by a coefficient β\beta that sets the channel’s maximum effect:

β Hill(x;K,S)=β1+(x/K)−S\beta\,\text{Hill}(x; K, S) = \frac{\beta}{1 + (x / K)^{-S}}

KK is the half-saturation point (Hill always equals one half at x=Kx = K) and SS is the slope. With S>1S > 1 the curve is S-shaped, convex near zero; with S≤1S \le 1 it’s concave from the start, and fixing S=1S = 1 gives what the authors call the “reach” transformation, a simpler curve with one fewer parameter. The full model adds a baseline τ\tau, linear control variables such as price, and normal noise. Our page on saturation curves covers how the Hill curve compares with the logistic and exponential alternatives.

Interactive
Rebuild the Jin et al. (2017) carryover and shape transforms

Set the paper's parameters, pick a spend flight, and see how the order of the two transforms changes the response you'd attribute to the same spend.

Lag weights w(l), normalized
Shape: Hill(x; K, S)
The same flight, transformed in each order
Total, adstock → Hill (paper)
0
Total, Hill → adstock
0
Difference from order
0%
Effect after flight ends
0%
Peak week (adstock → Hill)
1

Equations (1)–(4) of Jin et al. (2017). Spend is scaled to 0–1 as in the paper's simulations, the adstock is a normalized weighted average over L weeks (weeks 0 to L−1), and response is shown as a share of the channel's maximum effect β. Defaults follow the paper's Media 2 (α = 0.8, θ = 3, S = 2, L = 13) except K, which is set to 0.3. Invented flights, for intuition only.

The order question is one the paper raises and then settles quickly. If weekly spend is small relative to spend accumulated over the carryover window, saturation is better described on the accumulated (adstocked) amount, so you adstock first; if spend arrives in concentrated on-and-off bursts, applying the shape first may be preferable. The authors chose adstock-then-shape because it fit their data. The widget shows why the choice isn’t cosmetic: with the default four-week burst and the paper’s Media 2 settings, adstock-first credits the same spend with roughly a third more response, because spreading the burst over the carryover window keeps each week on the steep part of the curve. For always-on spend the two orders agree almost exactly.

py
Jin et al. (2017) transforms in PythonDelayed and geometric adstock, Hill, both orders, and ROAS/mROAS by the paper's definitions, run on the practice CSV.
Download

Why the Hill parameters are so hard to estimate

One of the most practically useful sections is a short warning about identifiability. The authors show pairs of Hill curves with very different parameters that are almost indistinguishable over the range of spend you actually observed. Their clearest example is a channel whose half-saturation point lies outside the observed spend: with spend scaled to 0-1, a curve with K=1.5K = 1.5, S=2S = 2, β=0.8\beta = 0.8 and one with K=2K = 2, S=1.867S = 1.867, β=1.144\beta = 1.144 differ by less than 0.003 anywhere in that range, then diverge as soon as you extrapolate.

Observed spend00.20.40.60123Scaled spendK = 2, S = 1.867, β = 1.144K = 1.5, S = 2, β = 0.8
Two Hill curves from Jin et al.'s Figure 2 that agree within observed spend (0 to 1) and disagree beyond it. Recomputed from the parameters in the paper. Source: Jin et al. (2017), Vexpower recomputation.

The consequence is that you can get the response curve right inside your data while getting every individual parameter wrong, and that any answer about doubling spend is an extrapolation the data can’t check. The authors’ practical advice follows from this: constrain the prior on KK to the range of observed spend so the sampler doesn’t wander, and consider the simpler reach curve when the data can’t support a free slope. In my experience this is the single most common way MMM results get oversold, because the response curve chart looks equally confident at three times current spend as it does at current spend.

How the Bayesian model is estimated, and the priors it uses

The authors implemented two samplers: a custom Gibbs sampler in C++ using slice sampling, and a Stan version using Hamiltonian Monte Carlo (the Stan code is in the paper’s appendix). On their simulated dataset the Gibbs sampler ran 10,000 iterations in 52 seconds while Stan took 1,149 seconds for 1,000, because the transformation parameters are highly correlated with each other, which Stan’s sampler finds hard. In the real-data example they also found that orthogonalizing three highly correlated control variables cut Stan’s run time from 3,040 seconds to 75.

The priors are the part people copy without reading. These are the ones used for the simulations, chosen to contain the true values but with a lot of spread around them:

ParameterMeaningPrior in the simulations
α\alphaRetention ratebeta(3, 3)
θ\thetaDelay to peak (weeks)uniform(0, 12)
KKHalf-saturation point (spend scaled 0-1)beta(2, 2)
SSHill slopegamma(3, 1)
β\betaMaximum effect of the channelhalf normal(0, 1)
τ\tauBaselinenormal(0, 5)
γ\gammaControl variable (price) effectnormal(0, 1)
noise varianceResidual varianceinverse gamma(0.05, 0.0005)

The reasoning is sensible and still holds: retention lives between zero and one, so it gets a beta prior; the delay is bounded by the carryover window; the slope gets a gamma with a positive mode; media coefficients are constrained nonnegative with a half normal because nobody believes advertising reduces sales. If you’re setting priors in PyMC-Marketing or Meridian, the Bayesian MMM guide shows how a prior and weak data combine, which is exactly the situation this paper goes on to describe.

ROAS and mROAS, defined the way Google still defines them

The paper’s attribution definitions are its most durable contribution. ROAS for a channel is calculated by setting that channel’s spend to zero during a chosen “change period”, predicting sales with and without it, and dividing the difference by the period’s spend. The detail that matters is that the difference is summed over the change period plus the following L−1L - 1 weeks, because carryover means spend in the last week of the period still sells in the weeks after it:

ROASm=∑t0≤t≤t1+L−1[Y^t(xm)−Y^t(x~m)]∑t0≤t≤t1xt,m\text{ROAS}_m = \frac{\sum_{t_0 \le t \le t_1 + L - 1} \left[ \hat{Y}_t(x_m) - \hat{Y}_t(\tilde{x}_m) \right]}{\sum_{t_0 \le t \le t_1} x_{t,m}}

Marginal ROAS is the same comparison for a small change, the extra revenue from raising the period’s spend by one percent, divided by that one percent of spend. Both are computed for every posterior draw, giving a full distribution, and the authors warn against the shortcut of plugging posterior means or medians of the parameters into the formula, because that ignores how correlated the parameters are. If the gap between average and marginal ROAS is new to you, that page draws both off the same curve.

The same logic carries into optimization. The authors maximize predicted sales, including the post-period, under a fixed total budget, and show two ways to do it with posterior samples: optimize the average across draws (stable), or optimize each draw and look at the spread of optimal mixes (honest). In their simulation the second approach found a unimodal answer when the budget was near historical levels but a three-mode posterior when the budget was halved, because the model was predicting in a sparse part of the data. That’s the paper’s point about budget allocation in a sentence: the optimizer always returns an answer, but the spread of answers tells you whether to believe it.

What the simulations found about data needs and bias

The headline experiment repeats the estimation on 500 simulated datasets, each with three media channels and price, once with two years of weekly data and once with 60 years. The simulated signal is generous (the media channels explain 18.1, 19.4 and 5.8 percent of sales variance, price 22.5 percent and noise 12.9 percent), and the authors say it’s as strong as or stronger than most real datasets they had seen. Even so, with two years of data the estimated response curves were biased downwards for every channel:

ChannelBias at spend 0.5, two yearsBias at spend 0.5, 60 yearsBias at spend 1, two yearsBias at spend 1, 60 years
Media 1−39.7%−0.2%−32.5%−0.2%
Media 2−25.6%3.4%−18.1%3.3%
Media 3−39.0%10.4%−25.3%10.4%

The adstock parameters held up reasonably well; the delay was estimated with low bias even in small samples. The shape parameters were the problem: even with 60 years of data the individual estimates of KK, SS and β\beta varied widely, while the curve they combine into was recovered. Media 1 had the worst bias despite similar signal strength to Media 2, because its true slope was one, the case where the Hill curve is least identifiable. The authors attribute the small-sample bias to the priors: when the data are weak, the posterior is mostly prior, and the data can’t correct whatever the prior gets wrong.

They then tested this directly by swapping priors. Replacing the half normal(0, 1) prior on β\beta with uniform(0, 3), which puts more weight on large effects, cut Media 2’s bias at spend 0.5 from −25.5 percent to −4.5 percent. The authors are careful to say this doesn’t make uniform(0, 3) a better prior, since in other situations it would push curves too high, which is the real lesson: in small data, your prior choice is a choice about your answer. Priors on KK mattered much less for the curve, but when the true KK was outside the observed range, no prior recovered it. They also note that their 60-year scenario isn’t a recommendation, since markets change over decades, and point to geo and category data as the realistic ways to get more information, which is where the geo-level hierarchical paper picks up.

The shampoo case: when the posterior is just the prior

The real-data example uses 2.5 years of weekly data for a shampoo advertiser, provided by Neustar MarketShare, with five channels (TV, magazines, display, YouTube and search) and price, distribution and promotion as controls, and log volume sales as the outcome. The authors fit four versions, crossing delayed or geometric adstock with a free Hill slope or the simpler reach curve, and compare them with the Bayesian information criterion. The four fit almost identically (negative log likelihoods between 98.06 and 98.12), so BIC favors the simplest, geometric adstock with the reach curve, by a wide margin (51.49 against 98.12 for the most complex).

The results are a lesson in humility. The Hill-slope models produced response curve intervals far wider than the reach-curve models, so the extra flexibility bought variance, not accuracy. The delay parameter wasn’t estimated well in either delayed model. For TV, the posterior for the retention rate looked almost exactly like its prior, meaning the data had nothing to say about it. When the authors optimized the split between TV and magazines, the posterior for the optimal TV share piled up at both extremes, and predicted sales varied more across posterior draws than across budget splits. As the abstract puts it, “the optimal media mix based on the model has a large variance”.

They also report significant residual autocorrelation out to about 15 weeks, which they read as a sign the model is misspecified. I find it refreshing that a paper proposing a method spends its real-data section showing the method’s limits, and it’s the section I’d most like every MMM buyer to read. The diagnostics behind that kind of finding are covered in our model diagnostics guide.

Why this paper shaped LightweightMMM and Meridian

LightweightMMM, Google’s earlier open-source library, offered three model types, and its “carryover” model uses exactly this paper’s delayed weights, τ(l−θ)2\tau^{(l-\theta)^2} normalized over a 13-week window, with its documentation pointing to Jin et al. for the details and choice of priors. Its README cites this paper, Chan and Perry, and Sun et al. as its basis. Since Google released Meridian in January 2025, the LightweightMMM repository has been archived and points users there; our LightweightMMM page maps the migration.

Meridian keeps the paper’s structure almost intact: a normalized weighted adstock over a maximum lag, the same Hill function with a half-saturation point and slope, adstock applied before Hill by default, and a hill_before_adstock option for the reverse order this paper discussed. Its ROI and marginal ROI follow the same counterfactual logic of switching spend off or nudging it up, and its references list still includes Jin et al. What Meridian adds is mostly the paper’s own recommendations: geo-level hierarchical data from Sun et al., priors set directly on ROI so experiments can feed in (from Zhang et al.’s 2024 calibration paper), and search query volume as a control for paid search bias. The research papers bibliography lists all of them in order.

In practice, I read this paper as both a recipe and a warning label. The recipe (delayed or geometric adstock, Hill or reach curves, ROAS from counterfactual predictions over posterior draws) is sound and is what the tools implement. The warning is that two years of national weekly data usually can’t pin the recipe down, so the priors, the choice of transform and the order you apply them in will quietly decide your answer unless you bring in more information through geo data, category data or experiments. If you want to build the whole thing yourself, our Python MMM walkthrough starts from the same transforms, and the pillar guide puts them in context.

Downloads

csv
Jin et al. transforms, weekly series (CSV from the widget)The default 4-week burst run through delayed adstock and Hill in both orders.
Download
py
Jin et al. (2017) transforms in PythonDelayed and geometric adstock, Hill, both orders, and ROAS/mROAS by the paper's definitions, run on the practice CSV.
Download

Frequently asked questions

What is the delayed adstock function in Jin et al. (2017)?

It's a carryover weight that peaks after a delay instead of in the week of spend. The weight for lag l is the retention rate raised to the power of (l minus theta) squared, where theta is the delay to the peak, and the weights over L weeks are normalized to sum to one. With theta set to zero it peaks immediately, like geometric adstock.

Does Jin et al. apply adstock before or after the Hill function?

The paper applies adstock first and then the Hill function, which it says suits data where weekly spend is small relative to cumulative spend. It notes that if spend is concentrated in on-and-off bursts, applying the shape transformation first might be preferable. Meridian keeps adstock first by default and offers a hill_before_adstock option.

How much data does a Bayesian MMM need according to Jin et al.?

The paper doesn't give a single number, but its simulations show that two years of weekly national data underestimated the response curves by roughly 18 to 40 percent, with the priors driving much of the result, while 60 years of simulated data recovered them almost exactly. The authors conclude that more informative data and priors, such as geo-level or category data, are needed.

How does Jin et al. define ROAS and mROAS?

ROAS is the change in predicted revenue when a channel's spend is set to zero during a chosen period, including the carryover that lands after the period, divided by the spend in that period. Marginal ROAS is the extra revenue from increasing the period's spend by one percent, divided by that one percent of spend. Both are computed for every posterior draw.

Is Jin et al. (2017) peer reviewed?

It was published by Google on its research site rather than in a journal, and it's cited as Google Inc. (2017). It has nonetheless become one of the most cited references in applied MMM, and Meridian's documentation still lists it in its references.

References

  1. Jin, Wang, Sun, Chan & Koehler (2017), Bayesian Methods for Media Mix Modeling with Carryover and Shape Effects PDF dated 14 April 2017; all equations, tables and simulation results on this page.
  2. Chan & Perry (2017), Challenges and Opportunities in Media Mix Modeling
  3. LightweightMMM documentation: models The carryover model uses the same delayed weights and cites Jin et al.
  4. LightweightMMM README (archived January 2026)
  5. Meridian model specification Normalized adstock, Hill, hill_before_adstock option, geo hierarchy.
  6. Meridian references list
Mike Taylor
Mike Taylor

I've built marketing mix models for Monzo Bank, Booking.com, Time Out, The AA and others, advised Google, Appsflyer and Recast on MMM, and teach marketing mix modeling on LinkedIn Learning. Before that I co-founded a 50-person growth marketing agency. I write the Vexpower MMM course.

Keep reading

Learn MMM by doing itThe Vexpower course walks through thirty lessons on one invented brand, with simulators, Python labs and a decision case you can defend.
See the course