SpendReach#

class pymc_marketing.mmm.spend_reach.SpendReach(effective_l_max, requires_full_axis, measured=<factory>, max_lag=None)[source]#

What the evaluation is allowed to assume about its window.

The whole contract between this module and Incrementality: the window length, the evaluation mode and the longest lag, plus the per-node measurements they were derived from for anyone who wants to see the working.

Parameters:
effective_l_maxint

Evaluation-window half-length covering every path spend can take – the model’s own adstock.l_max plus the widest extra carryover measured. A mediated path that chains a second adstock outlives the direct one, and a window sized for the direct path alone would cut the tail off.

requires_full_axisbool

Whether every period has to be evaluated on the complete fitted date axis, because some node’s value depends on the whole series.

measuredmapping

Per evaluated node, its TemporalReach. Empty when no probe was possible.

max_lagint or None, default=None

The last lag, in data periods after the spend date, at which a change in spend moves any evaluated node. Not effective_l_max - 1: the window is one date longer than a plain adstock’s kernel, which covers lags 0 .. l_max - 1, while a mediated tail that outlives the direct path sizes the window to exactly its own last lag. Never less than the kernel’s own trailing lags (l_max - 1 under ConvMode.After, l_max // 2 under Overlap, none under Before; see kernel_trailing_lags()), so a plain adstock’s horizon is its kernel length and does not shift with how far the sampled weights stay above SpendProbe.REACH_TOLERANCE. Measured only: a declaration wider than the measurement widens the window, but the documented recipe declares a mediator’s own l_max, which overstates the chained reach, so it does not move this. None exactly when requires_full_axis: no window bounds the reach, so there is no longest lag to report. Any other combination raises ValueError, so a windowed reach always carries a horizon.

Methods

SpendReach.__init__(effective_l_max, ...[, ...])

Attributes