pymc-marketing
Marketing Statistical Models in PyMC
What it is and what it does
PyMC-Marketing is a Bayesian statistical modeling library for marketing analytics built on top of PyMC, ArviZ, and related tools. It provides domain-specific implementations of Marketing Mix Models, Customer Lifetime Value estimation, discrete choice models, and experimentation frameworks that allow marketers and analysts to quantify the causal impact of marketing channels and customer behaviors.
The package is designed for practitioners who want to move beyond frequentist attribution methods and leverage Bayesian inference to incorporate prior knowledge, handle uncertainty explicitly, and make probabilistic predictions. It includes features like adstock transformations to model carryover effects, saturation functions to capture diminishing returns, time-varying intercepts and media efficiency, and causal identification tools via directed acyclic graphs. Models can be customized with domain-specific priors and likelihoods, and inference can be run on CPUs or GPUs via PyMC's backend options.
Use it for:
- Quantify the incremental impact of each marketing channel on sales or conversions using Bayesian MMM with carryover and saturation effects.
- Estimate customer lifetime value distributions to inform acquisition budgets and retention strategies.
- Analyze discrete choice behavior (e.g., MaxDiff surveys, product preferences) using Bayesian hierarchical choice models.
- Test incrementality of marketing experiments with PIE (Predicted Incrementality by Experimentation) framework.
- Model product adoption and diffusion curves using Bass Diffusion models for new product forecasting.
- Incorporate causal domain knowledge via DAGs to identify confounders and improve model validity.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
PyMC-Marketing provides Bayesian statistical models for marketing analytics, including Marketing Mix Modeling (MMM), Customer Lifetime Value (CLV), Customer Choice, Bass Diffusion, and Predicted Incrementality by Experimentation (PIE).
Yes, if you need Bayesian marketing analytics and are comfortable with the PyMC ecosystem. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and offers specialized tools for MMM and CLV that are difficult to assemble from scratch. Requires Python >= 3.12 and a substantial dependency stack; best suited for teams with statistical modeling experience or access to consulting support.
Install
pymc-marketing on PyPI
pip
pip install pymc-marketinguv
uv add pymc-marketingpoetry
poetry add pymc-marketingInstalling pymc-marketing
Before you install
Low install friction with a pure-Python wheel. Active maintenance with a release 7 days ago and ongoing commits. Requires Python >= 3.12 and depends on a large Bayesian stack (pymc, arviz, pytensor, numpy, pandas, scikit-learn, and others).
License in practice
Apache License 2.0 is permissive; you may use, modify, and distribute this package freely in commercial and private projects, provided you include the license and attribute changes.
Quickstart
pip install pymc-marketing
import pymc_marketing
from pymc_marketing.mmm import MMM
# Create and fit a Marketing Mix Model
model = MMM(data=your_data, adstock='geometric', saturation='logistic')
model.fit()
Requires Python >= 3.12. Fitting models requires sufficient memory for Bayesian sampling and may be computationally intensive depending on data size and model complexity.
Verify before relying
- Whether optional extras (dag, pie) are commonly needed or if base installation covers most use cases
- Typical model fitting time and computational requirements for datasets of different sizes
- How well the package integrates with existing marketing analytics pipelines outside the PyMC ecosystem
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 19 — arviz-plots, arviz, matplotlib, narwhals, numpy, pandas, patsy, preliz, pydantic, pymc-extras, pymc, pyprojroot, pytensor, pyyaml, scikit-learn, seaborn, tqdm, xarray-einstats, xarray |
| Maintenance | actively maintained — 7 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 184,703/month — #10,026 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymc_marketing-1.0.0-py3-none-any.whl
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
google-meridianMeridian is a Bayesian marketing mix modeling…
unclear · top 15,000 on PyPI
LifetimesLifetimes models customer behavior and predicts…
permissive · top 15,000 on PyPI
pymcPyMC is a Python package for Bayesian…
permissive · top 5,000 on PyPI
pymc3PyMC3 is a Python package for Bayesian…
permissive · top 15,000 on PyPI
pycdcSearches the web for gift ideas and client…
permissive · top 15,000 on PyPI
pymc-extrasExtends PyMC with specialized distributions,…
permissive · top 15,000 on PyPI
nutpienutpie provides a fast NUTS sampler for…
permissive · top 15,000 on PyPI
matrice-analyticsProvides post-processing and analytics for…
unclear · top 5,000 on PyPI
arviz-plotsarviz-plots provides visualization functions…
permissive · top 15,000 on PyPI
arviz-statsProvides statistical computations and…
permissive · top 15,000 on PyPI