CounterfactualScenarios#

class pymc_marketing.mmm.counterfactual.CounterfactualScenarios(spend, period_index, rows)[source]#

Perturbed spend arrays for every scenario that has to be evaluated.

A scenario is a (period, perturbed channel) pair. When no mu_effect stands between spend and the response, a single all-channels perturbation per period suffices and every channel reads its own column out of it, so all of a period’s keys point at the same row – see EvaluationWindows.build_scenarios().

Parameters:
spendnp.ndarray

Counterfactual channel_data, shape (n_scenarios, max_window, *extra_shape).

period_indexnp.ndarray

Period each scenario belongs to, shape (n_scenarios,). Indexes any per-period array (a windowed data variable, a time_index row) up to the scenario axis.

rowsdict

Maps a _ScenarioKey to a row of spend.

See also

PeriodWindow

Which dates each period is evaluated over, and which are summed.

Methods

Attributes

spend

period_index

rows