Bayesian modeling with PyMC: model specification, priors, NUTS/VI fitting, diagnostics, posterior predictive checks, LOO/WAIC comparison, prediction, and code review.
Resources
3Install
npx skillscat add yuukias/ai-skills-collection/pymc Install via the SkillsCat registry.
SKILL.md
PyMC Bayesian Modeling
Workflow
- Clarify estimand, data-generating assumptions, likelihood family, grouping structure, missingness, and prediction target.
- Specify priors before seeing fit results. Use weakly informative or domain-informed priors and run prior predictive checks.
- Build the PyMC model with named coordinates/dimensions, stable parameterization, and
pm.Datawhen predictions or updates are needed. - Fit with NUTS by default. Save
InferenceDatawith log likelihood when model comparison is needed. - Diagnose sampling: divergences, R-hat, ESS, BFMI, tree depth, trace plots, and energy plots. Reparameterize before increasing draws blindly.
- Validate fit with posterior predictive checks, residual or calibration checks, sensitivity to priors, and domain plausibility.
- Compare models with LOO/WAIC only when likelihood and data structure make comparison meaningful.
- Report posterior quantities with uncertainty intervals, model limitations, and reproducible code.
References
- Read
references/modeling-workflow.mdfor prior, likelihood, diagnostic, and reporting checklists. - Read
references/legacy-full-skill.mdfor older PyMC code patterns and examples when needed. - Read
bayesian-ppl-diagnostics/references/reference.mdwhen diagnosing Stan/PyMC/ArviZ outputs across PPLs.
Validation
- Prior predictive checks are shown or explicitly waived with a reason.
- Divergences are investigated, not ignored.
- Posterior claims match the modeled estimand and include uncertainty.