Is the spend-share prior from the MMM example notebook (HALFNORMAL_SCALE * n_channels * spend_share) wrong for models with many channels?

Hi all,

I’d like a sanity check on a prior from the pymc-marketing MMM example notebook. We adopted it some time ago, and I’m no longer sure it is correct. I’d like to understand whether it is actually flawed, or whether I’m misreading what it is meant to do.

In the example notebook up to version 0.6.0:

HALFNORMAL_SCALE = 1 / np.sqrt(1 - 2 / np.pi)
n_channels = 2
prior_sigma = HALFNORMAL_SCALE * n_channels * spend_share.to_numpy()
model_config = {"saturation_beta": Prior("HalfNormal", sigma=prior_sigma, dims="channel")}

Since 0.7.0 the example uses prior_sigma = n_channels * spend_share

Here is how I read these decisions:

  • With HALFNORMAL_SCALE, the standard deviation of beta_c is n_channels * spend_share_c. The average channel therefore gets an SD of 1, i.e. a maximum weekly effect on the order of the maximum weekly revenue, since the target is max-scaled.
  • The spend shares sum to 1, so summed over all channels the prior scale is n_channels. The total media effect expected before seeing the data grows linearly with the number of channels. It does not depend on how much is actually spent relative to revenue.
  • With 2 channels, as in the example, this is moderate. However, this becomes a problem with an increasing amount of channels.
  1. Is my reading correct that this prior implies a total media effect that scales with n_channels? Or am I missing something, e.g. how the scaling of the target or the channels interacts with it?
  2. Was this intended, e.g. “unit variance per channel” as a deliberately weak prior? Or was the example written with only the 2-channel case in mind?
  3. Was dropping HALFNORMAL_SCALE in 0.7.0 meant to address this, or was it an unrelated change?
  4. Would you call this prior wrong for models with a higher number of channels, or just a heuristic that always needs a prior predictive check? If the latter, would a short note in the example be welcome?

Thanks!

What’s spend_share? If that goes down with number of channels, then no. If it’s a constant, then yes.

If by “wrong,” you mean not having reasonable prior predictive checks, then it’s almost certainly wrong. As are most high-dimensional priors defined independently by parameter. The problem is that the parameters are almost always correlated and choosing them independently sends you way out into the tails with prior predictive draws.

Thanks Bob, that helps.

spend_share is defined in the pymc notebook as each channel’s share of total spend, so it sums to 1 and averages 1/n. What the notebook leaves implicit is that multiplying by n_channels cancels the 1/n exactly: sigma_c averages 1.66 regardless of n, so summed over channels the prior scale grows as 1.66*n. Since each channel is also max scaled on its own before saturation, this should map onto your constant case.

The problem is that the parameters are almost always correlated and choosing them independently sends you way out into the tails with prior predictive draws.

That matches what we see. A follow-up question: for this kind of model, would you recommend putting the prior on the total instead? For example, a prior on the total media share of revenue, split across channels with, e.g. a Dirichlet (with spend share weighting). Or tune via prior predictive checks?