IncrementalReducer#

class pymc_marketing.mmm.incrementality.IncrementalReducer[source]#

Map a linear-predictor perturbation to a response-scale increment.

Incrementality perturbs spend and evaluates channel_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 LinkSpec implementations; see Incrementality._build_reducer() for the dispatch.

See also

IdentityLinkReducer

Additive response (link="identity").

LogLinkReducer

Multiplicative response (link="log").

Notes

Every subclass assumes delta is the complete change in the linear predictor: channel_contribution plus every channel-dependent mu_effect the 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, by assert_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)

IncrementalReducer.counterfactual_minus_baseline(delta)

Return \(\sum_t [\hat{Y}^{\text{cf}}_t - \hat{Y}_t]\).