Summary and Export
mmm.summary is the retained tabular summary surface for fitted PanelMMM
models.
It is backed by MMMSummaryFactory and returns pandas or polars DataFrames
that you can export with normal DataFrame methods.
For predictive diagnostics and JSON-ready reports, see Diagnostics.
Use mmm.summary
The simplest path is the bound summary factory on the fitted model:
mmm.summary already has access to:
mmm.data- the fitted
PanelMMM - the default summary settings
Construct MMMSummaryFactory manually
If you want custom defaults, build the factory yourself:
This is useful when you want one summary object with consistent HDI and output settings across multiple tables.
Common summary methods
| Method | What it returns |
|---|---|
posterior_predictive() |
Posterior predictive summaries aligned to the wrapped target data |
contributions() |
Tidy contribution summaries by component type |
mean_contributions_over_time() |
Wide decomposition table |
roas() / cost_per_target() / efficiency() |
Efficiency summaries |
channel_spend() |
Raw spend table |
saturation_curves() / adstock_curves() |
Transformation-curve summaries |
total_contribution() |
Component-level totals |
change_over_time() |
Period-on-period percentage change in channel contributions |
Choose output format
MMMSummaryFactory supports:
output_format="pandas"output_format="polars"
Example:
If you request polars without Polars installed, Abacus raises an
ImportError.
Configure HDI probabilities
Pass HDI probabilities as numbers strictly between 0 and 1:
Do not pass percentages such as 80 or 94.
Summary tables include interval columns named from those probabilities. For
example, hdi_probs=[0.94] produces columns such as:
abs_error_94_lowerabs_error_94_upper
These columns contain interval endpoints, not error magnitudes. Abacus uses
ArviZ’s single contiguous empirical HDI for both chain/draw and sample
layouts. Reshaping the same draws does not change the bounds. Means, medians,
coordinate labels and output column names are independent of that layout.
NaNs are not silently removed before calculating the HDI; inspect non-finite
bounds before interpreting or exporting them.
Each interval summarises one output coordinate. Curve intervals are pointwise, not simultaneous bands over a whole response curve. A single contiguous interval also need not represent a disconnected highest-density set for a multimodal posterior.
Earlier versions used equal-tailed quantiles for arrays with a sample
dimension, including curve summaries. Those bounds can differ materially from
HDIs for skewed draws. Recompute affected tables from the same saved draws to
obtain consistent HDIs; no refit is required. Means, medians and column names
remain unchanged.
Blocked holdout coverage
uses equal-tailed predictive intervals. Its coverage_* fields do not measure
coverage of these HDI columns.
Aggregate over time
Many summary methods accept frequency with one of these values:
originalweeklymonthlyquarterlyyearlyall_time
Example:
all_time removes the date dimension. That is useful for fully aggregated
tables, but date-dependent summaries still need a date axis.
Do not use all_time with:
mean_contributions_over_time()change_over_time()
Export tables
Abacus does not add a separate export wrapper on top of the returned DataFrames. Use the normal DataFrame methods from your selected backend:
With Polars:
Export diagnostic reports
Diagnostic report objects expose to_dict() for JSON-ready export:
Common pitfalls
- Expecting a dedicated file-export API on
mmm.summary - Passing
94instead of0.94inhdi_probs - Using
saturation_curves()oradstock_curves()from a manual factory withoutmodel=mmm - Using
all_timeon summaries that require a date dimension