An agentic system that interprets Marketing Mix Model outputs, selects appropriate causal methods (DiD, Synthetic Control, BSTS), and generates natural-language explanations of promotional ROI.
Context: Built to automate the explanation workflow for MMM results. Analysts spend significant time translating Bayesian posterior distributions into business recommendations — this agent handles the first pass.
flowchart TB
U[User Query] --> R[Router Agent]
R --> |ROI question| ROI[ROI Explainer]
R --> |Causal question| CI[Causal Inference Engine]
R --> |Budget question| BO[Budget Optimizer]
R --> |Data question| SQL[Text-to-SQL Agent]
ROI --> S[Synthesizer]
CI --> S
BO --> S
SQL --> S
S --> E[Executive Summary]
Marketing analysts need to answer causal questions about promotional effectiveness: "Did the digital campaign cause the sales lift, or was it seasonal?" Standard MMM provides correlational ROI, but stakeholders need causal reasoning with appropriate uncertainty quantification.
where
For treated unit
Treatment effect:
Posterior predictive distribution for the counterfactual:
Test:
The backdoor adjustment formula — distinguishing
Mutual information between channel spend
This repo directly automates my causal inference workflow in enterprise pharma settings:
| Enterprise Work | Agent Implementation |
|---|---|
| Geo-lift analysis for TV campaigns | CausalInferenceEngine with synthetic control |
| "Did email cause the Rx lift?" | DAG-based causal reasoning with do-calculus |
| Budget reallocation justification | Counterfactual simulation with CIs |
| PoC causal inference with NBE team | Bayesian structural time series |
| PyMC-Marketing MMM interpretation | ROI Explainer with posterior reasoning |
Key insight: In enterprise pharma, I PoC'd geo-lift analysis applying causal inference methods. This agent automates the "explain why" step that analysts spend hours on.
git clone https://github.com/fab-admasu/mmm-causal-explainer-agent.git
cd mmm-causal-explainer-agent
pip install -r requirements.txt
# Generate synthetic causal scenarios
python scripts/generate_causal_scenarios.py --n_scenarios 200
# Fine-tune causal reasoning adapter
python scripts/train_causal_sft.py --config configs/causal_config.yaml
# Run agent demo
python scripts/run_agent.py --query "Did our TV campaign cause the 8% Rx lift for Cardivex?"| Metric | Base LFM2.5 | + Causal SFT | + Tool-Use |
|---|---|---|---|
| Causal reasoning accuracy | 35% | 72% | 84% |
| Correct uncertainty hedging | 28% | 68% | 81% |
| Appropriate method selection | 22% | 65% | 78% |
| Actionable recommendations | 45% | 76% | 88% |
| Hallucination rate | 18% | 5% | 3% |
MIT

