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 ofbeta_cisn_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.
- 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? - 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?
- Was dropping
HALFNORMAL_SCALEin 0.7.0 meant to address this, or was it an unrelated change? - 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!