pymc

Build, fit, and validate Bayesian models with PyMC using MCMC and variational inference.

33.0k|3.2k|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill pymc-k-dense-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pymc
Source: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/scientific-skills/pymc
Command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill pymc-k-dense-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires arviz, numpy, pandas, matplotlib, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

PyMC enables building, fitting, validating, and comparing Bayesian models to quantify uncertainty, enabling principled decision making across data-rich domains.

Core Features & Use Cases

  • Hierarchical/multilevel modeling with non-centered parameterization
  • MCMC sampling (NUTS) and variational inference for scalable inference
  • Posterior predictive checks and model comparison (LOO/WAIC)
  • Use Case: Researchers can fit complex models to group-structured data and compare competing specifications to select robust explanations.

Quick Start

Load your data, build a PyMC model (e.g., linear regression), run MCMC with NUTS, and examine posterior diagnostics and predictions.

Frequently Asked Questions about pymc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build and validate Bayesian models with MCMC?

To build and validate Bayesian models with MCMC, define probabilistic structures using PyMC, fit them using NUTS sampling, and evaluate results via posterior predictive checks and diagnostics. This workflow quantifies uncertainty for principled decision making.

What is hierarchical modeling and when should I use non-centered parameterization?

Hierarchical modeling fits complex group-structured data by estimating varying effects across multiple levels. Non-centered parameterization is used within this probabilistic modeling approach to improve MCMC sampling efficiency and avoid divergences in hierarchical models.

How do I compare competing Bayesian models using LOO or WAIC?

Compare competing Bayesian models using LOO or WAIC by computing information criteria from posterior distributions. These model comparison techniques estimate out-of-sample predictive accuracy to help select the most robust statistical explanation for your data.

Does PyMC support variational inference for scalable Bayesian inference?

Yes, PyMC supports variational inference alongside MCMC sampling for scalable Bayesian inference. Variational inference provides faster approximate posterior estimates, making probabilistic modeling feasible for larger datasets where traditional MCMC is computationally expensive.

What's the best way to run posterior predictive checks after MCMC sampling?

The best way to run posterior predictive checks after MCMC sampling is to generate replicated data from the fitted posterior distribution and compare its distribution against observed data. This validates Bayesian model fit and reveals systematic discrepancies.

Can I use ArviZ with PyMC for Bayesian diagnostics and visualizations?

Yes, you can use ArviZ with PyMC for Bayesian diagnostics and visualizations. ArviZ processes posterior distributions and inference data generated by PyMC's MCMC and variational inference workflows to produce trace plots, diagnostic summaries, and model comparison metrics.