ExperimentDesigner#

class pymc_marketing.mmm.experiment_design.designer.ExperimentDesigner(mmm)[source]#

Posterior-aware experiment designer for marketing lift tests.

Consumes a fitted MMM and recommends which experiment to run based on posterior uncertainty. Supports national-level experiments analysed via Interrupted Time Series (ITS).

The designer uses the model’s own computational graph (via extract_response_distribution) to evaluate channel contributions, so it works with any adstock/saturation combination automatically.

Note

Assurance values are conditional on the MMM being reasonably well-identified. If a channel’s effect is confounded (e.g., spend correlates strongly with seasonal demand or another channel), the posterior may be confidently wrong, producing misleadingly high assurance. Always review model diagnostics (posterior predictive checks, prior sensitivity, spend correlation) before acting on recommendations. High spend correlation is flagged automatically in each recommendation’s rationale.

Parameters:
mmmMMM

A fitted pymc_marketing.mmm.multidimensional.MMM instance (or the legacy pymc_marketing.mmm.MMM). Must have been fitted (mmm.idata is not None).

Raises:
ValueError

If the MMM has not been fitted.

NotImplementedError

If adstock_first=False (not supported in v1).

Examples

from pymc_marketing.mmm import MMM
from pymc_marketing.mmm.experiment_design import ExperimentDesigner

mmm = MMM(...)
mmm.fit(X, y)

designer = ExperimentDesigner(mmm)
recommendations = designer.recommend(
    spend_changes=[0.1, 0.2, 0.3, -0.5, -1.0],
    durations=[4, 6, 8, 12],
)

Methods

ExperimentDesigner.__init__(mmm)

ExperimentDesigner.from_idata(idata[, ...])

Create an ExperimentDesigner from a saved InferenceData fixture.

ExperimentDesigner.plot_adstock_ramp([...])

Plot adstock ramp fraction vs. experiment duration.

ExperimentDesigner.plot_channel_diagnostics([...])

Plot per-channel diagnostic summary.

ExperimentDesigner.plot_lift_distributions(channel)

Grid of lift posterior distributions for one channel.

ExperimentDesigner.plot_power_cost(...[, ...])

Scatter plot of assurance vs. absolute net cost.

ExperimentDesigner.plot_saturation_curve(channel)

Plot the saturation curve with posterior uncertainty.

ExperimentDesigner.recommend([...])

Recommend experiments across all channels.