mcmc-sampling-stan

Guide MCMC sampling with RStan or PyStan for Bayesian models.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/Zurybr/lefarma-skills --skill mcmc-sampling-stan-zurybr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcmc-sampling-stan
Source: https://github.com/Zurybr/lefarma-skills/tree/main/letta/benchmarks/trajectory-only/mcmc-sampling-stan
Command: npx skills add https://github.com/Zurybr/lefarma-skills --skill mcmc-sampling-stan-zurybr

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to performing Markov Chain Monte Carlo (MCMC) sampling using Stan, enabling users to implement and validate Bayesian statistical models effectively.

Core Features & Use Cases

  • Bayesian Model Implementation: Guides users through specifying models, priors, and parameters in Stan.
  • MCMC Sampling Configuration: Details how to set up iterations, warmup, and control parameters for robust sampling.
  • Diagnostic Checks: Emphasizes critical convergence and sampling diagnostics (R-hat, ESS, divergences) to ensure model validity.
  • Use Case: When fitting a complex hierarchical model to experimental data, this Skill ensures the Bayesian inference process is correctly set up, sampled, and validated using Stan.

Quick Start

Use the mcmc-sampling-stan skill to guide me through fitting a Bayesian model in Stan, focusing on diagnostic checks.

Frequently Asked Questions about mcmc-sampling-stan

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

FAQPage Schema
How do I perform MCMC sampling for Bayesian inference using Stan?

MCMC sampling in Stan involves specifying models, priors, and parameters, then configuring iterations and warmup to generate posterior samples for Bayesian inference. This process requires careful setup using RStan or PyStan workflows.

What diagnostics are needed to validate Bayesian MCMC sampling in Stan?

Critical diagnostics for MCMC sampling in Stan include checking R-hat for convergence, Effective Sample Size (ESS), and identifying divergences. These checks ensure model validity and that posterior sampling has correctly converged.

Can I use PyStan or RStan for fitting complex hierarchical Bayesian models?

Yes, both RStan and PyStan support fitting complex hierarchical models by guiding you through model specification, environment setup, and sampling configuration to perform Bayesian inference on experimental data.

How do I configure warmup and iterations for robust MCMC sampling in Stan?

Configuring MCMC sampling in Stan involves setting appropriate iterations, warmup periods, and control parameters. These settings ensure robust sampling and accurate posterior distributions during Bayesian statistical modeling.

Why do I need to check divergences when performing Bayesian inference with Stan?

Checking divergences during MCMC sampling in Stan is critical because they indicate potential issues with the posterior geometry. Identifying divergences ensures the Bayesian inference process is correctly validated and model results are reliable.