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.

expm1 is used instead of exp(x) - 1 because marginal incrementality perturbs spend by only 1%, which makes \(\Delta\) small and the subtraction cancellation-prone.

Parameters:
baseline_responsexr.DataArray

Baseline prediction on the response scale – the model’s {output_var}_original_scale deterministic – with dimensions ("sample", "date", *custom_dims) and date coordinates spanning the fitted data. It already carries target_scale, so the increment needs no further rescaling.

Methods