Skip to content

Add CausalPy experiment integration#2283

Draft
cetagostini wants to merge 2 commits intomainfrom
cetagostini/integration_causalpy
Draft

Add CausalPy experiment integration#2283
cetagostini wants to merge 2 commits intomainfrom
cetagostini/integration_causalpy

Conversation

@cetagostini
Copy link
Contributor

@cetagostini cetagostini commented Feb 10, 2026

Description

Introduce a CausalPy bridge for MMM lift-test calibration:

  1. add pymc_marketing.mmm.experiment with ExperimentType, ExperimentResult and run_experiment (lazy-imports causalpy and converts results to lift-test DataFrame).
  2. Export ExperimentResult/ExperimentType from mmm package and integrate into MMM by adding MMM.experiment and MMM.add_lift_test convenience methods to run experiments and add their results as lift-test measurements.
  3. Add optional dependency "experiment = ["causalpy>=0.7.0"]" to pyproject.toml
  4. Comprehensive unit tests under tests/mmm/test_experiment.py.

Related Issue

Checklist


📚 Documentation preview 📚: https://pymc-marketing--2283.org.readthedocs.build/en/2283/

Introduce a CausalPy bridge for MMM lift-test calibration: add pymc_marketing.mmm.experiment with ExperimentType, ExperimentResult and run_experiment (lazy-imports causalpy and converts results to lift-test DataFrame). Export ExperimentResult/ExperimentType from mmm package and integrate into MMM by adding MMM.experiment and MMM.add_lift_test convenience methods to run experiments and add their results as lift-test measurements. Add optional dependency "experiment = [\"causalpy>=0.7.0\"]" to pyproject.toml and comprehensive unit tests under tests/mmm/test_experiment.py.
@codecov
Copy link

codecov bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 93.67089% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.05%. Comparing base (c717344) to head (f412258).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pymc_marketing/mmm/multidimensional.py 50.00% 3 Missing ⚠️
pymc_marketing/mmm/experiment.py 97.22% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2283   +/-   ##
=======================================
  Coverage   93.04%   93.05%           
=======================================
  Files          78       79    +1     
  Lines       12228    12307   +79     
=======================================
+ Hits        11378    11452   +74     
- Misses        850      855    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant