Prior Predictive Checks
Run prior predictive checks before fitting when you want to test whether your configured priors imply plausible target behaviour.
If you want the econometrics framing for this workflow, see Prior Predictive Checks for Econometricians.
Sample prior predictive draws
Use sample_prior_predictive(...) on PanelMMM:
In normal PanelMMM use, pass the same X and y structure that you plan to
fit.
sample_prior_predictive(...):
- builds the model if it has not been built yet
- samples from
pymc.sample_prior_predictive(...) - stores
priorandprior_predictiveonmmm.idataby default - returns an extracted
xarray.Datasetof prior predictive draws
How many draws Abacus uses
If you do not pass samples=..., Abacus uses:
sampler_config["draws"]when that key exists- otherwise
500
If you want prior predictive checks to use a different sample count from model
fitting, pass samples explicitly.
Plot prior predictive draws
After sampling, you can use the retained plotting surface:
You can then access the stored groups directly:
Trying to access these groups before sampling raises a runtime error.
Example prior predictive output:
What to inspect
A useful prior predictive check is about plausibility, not fit.
Check:
- scale: are draws on roughly the same order of magnitude as the observed target?
- support: do the draws violate obvious business constraints such as non-negativity?
- volatility: do the draws imply far more or far less variation than the real series?
- structure: do the trajectories look broadly plausible for the business and model configuration?
If the prior predictive distribution is implausible, change the model before you fit it.
Adjust the model before fitting
Typical changes include:
- tightening intercept or likelihood priors in
model_config - revising media transformation priors
- reducing unnecessary model flexibility
- checking whether your scaling choices make priors too loose on the model scale
See Priors and Configuration for the configuration surface.
Prior predictive before and after fit
If you run prior predictive checks first and then call fit(), Abacus keeps
the existing prior and prior_predictive groups on mmm.idata.
That makes it practical to compare:
- prior assumptions
- posterior fit
- posterior predictive behaviour
within one saved InferenceData object.
Common pitfalls
- Skipping prior predictive checks and only noticing implausible priors after a long fit
- Treating prior predictive checks as a substitute for posterior predictive assessment
- Forgetting that
sample_prior_predictive(...)returns extracted predictive draws, while the fullpriorandprior_predictivegroups are stored onmmm.idata
Next steps
After the prior predictive behaviour looks reasonable, fit the model with Fitting the Model.
