IncrementalReducer#
- class pymc_marketing.mmm.incrementality.IncrementalReducer[source]#
Map a linear-predictor perturbation to a response-scale increment.
Incrementalityperturbs spend and evaluateschannel_contribution, which lives in the linear predictor\[\mu_t = \text{base}_t + \sum_c v_{t,c}\]where \(v_{t,c}\) is channel c’s contribution and \(\text{base}_t\) collects the intercept, controls and seasonality. The response is \(\hat{Y}_t = \text{inv}(\mu_t)\,s\) for inverse link \(\text{inv}\) and target scale \(s\).
Translating \(\Delta_{t,m} = v^{\text{cf}}_{t,m} - v_{t,m}\) into a change in \(\hat{Y}\) is the only link-dependent step of the calculation, so it is isolated here. Subclasses correspond one-to-one to the
LinkSpecimplementations; seeIncrementality._build_reducer()for the dispatch.See also
IdentityLinkReducerAdditive response (
link="identity").LogLinkReducerMultiplicative response (
link="log").
Notes
Every subclass assumes delta is the complete change in the linear predictor:
channel_contributionplus every channel-dependentmu_effectthe counterfactual reaches. Collecting those terms is the caller’s job (Incrementality._delta_mu()), and that the collected nodes account for the whole move is checked rather than assumed, byassert_increment_is_complete(). A reducer only converts that change into a response-scale increment; it does not care how many nodes the change was collected from.Methods
IncrementalReducer.__init__(*args, **kwargs)Return \(\sum_t [\hat{Y}^{\text{cf}}_t - \hat{Y}_t]\).