CounterfactualSweep#

class pymc_marketing.mmm.marginal_effects.CounterfactualSweep(mmm, X, predictors, sweep_values, sweep_type='multiplicative')[source]#

CounterfactualSweep class is used to perform counterfactual analysis on MMM’s.

Methods

CounterfactualSweep.__init__(mmm, X, ...[, ...])

Initialize and run the counterfactual sweep.

CounterfactualSweep.compute_marginal_effects()

Compute marginal effects via finite differences from the sweep results.

CounterfactualSweep.create_intervention(...)

Apply the intervention to the predictors.

CounterfactualSweep.plot_marginal_effects([...])

Plot the marginal effects curve.

CounterfactualSweep.plot_uplift([hdi_prob, ax])

Plot the counterfactual uplift curve.

CounterfactualSweep.run_sweep()

Run the model's predict function over the sweep grid and store results.