LogLinkReducer#
- class pymc_marketing.mmm.incrementality.LogLinkReducer(baseline_response)[source]#
Increment reducer for a multiplicative response (
link="log").With \(\text{inv} = \exp\) the base term does not cancel. Because the linear predictor is additive in the channel contributions, perturbing channel m alone gives \(\exp(\mu^{\text{cf}}_t) = \exp(\mu_t)\exp(\Delta_{t,m})\), hence
\[\sum_t [\hat{Y}^{\text{cf}}_t - \hat{Y}_t] = \sum_t \hat{Y}_t \bigl[\exp(\Delta_{t,m}) - 1\bigr]\]so the baseline response \(\hat{Y}_t\) enters as a weight. This is the same estimand as
compute_counterfactual_contributions_dataset(), evaluated per posterior draw, but with the spend counterfactual and carryover window of the incrementality module rather than a whole-component knock-out.Two consequences follow, and both are properties of the model rather than artefacts of this implementation: per-channel increments depend on the baseline, the controls and the other channels; and they do not sum to the total media increment.
expm1is used instead ofexp(x) - 1because marginal incrementality perturbs spend by only 1%, which makes \(\Delta\) small and the subtraction cancellation-prone.- Parameters:
- baseline_response
xr.DataArray Baseline prediction on the response scale – the model’s
{output_var}_original_scaledeterministic – with dimensions("sample", "date", *custom_dims)anddatecoordinates spanning the fitted data. It already carriestarget_scale, so the increment needs no further rescaling.
- baseline_response
Methods
LogLinkReducer.__init__(baseline_response)