stan-fundamentals

Explain Stan 2.37 program structure, types, distributions, and workflow patterns.

9|1|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/choxos/BiostatAgent --skill stan-fundamentals
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stan-fundamentals
Source: https://github.com/choxos/BiostatAgent/tree/main/plugins/bayesian-modeling/skills/stan-fundamentals
Command: npx skills add https://github.com/choxos/BiostatAgent --skill stan-fundamentals

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Foundational knowledge for writing Stan 2.37 models including program structure, type system, distributions, and best practices. Use when creating or reviewing Stan models.

Core Features & Use Cases

  • Block structure familiarity: Stan model blocks (functions, data, transformed data, parameters, transformed parameters, model, generated quantities) in exact order, with empties allowed.
  • Type system and distributions: quick references for scalar, vector, matrix types and common priors and likelihoods.
  • Practical workflow patterns: vectorization, non-centered parameterization, target syntax, and model diagnostics.
  • R integration: using cmdstanr to compile and sample models from R.

Quick Start

Provide a concise Stan primer highlighting program structure, data types, and common distributions to help you start writing a Stan model.

Frequently Asked Questions about stan-fundamentals

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

FAQPage Schema
How do I structure a Stan model program with the correct block order?

Stan models require blocks in exact order: functions, data, transformed data, parameters, transformed parameters, model, and generated quantities. Empty blocks are allowed, providing flexible structure for probabilistic programming.

What data types and distributions does Stan support for statistical modeling?

Stan supports scalar, vector, and matrix types alongside common priors and likelihoods. These type system features enable precise statistical modeling and Bayesian inference for complex probabilistic programs.

How do I compile and sample Stan models using cmdstanr in R?

Use cmdstanr in R to compile and sample Stan models. This R integration streamlines the Bayesian inference workflow by connecting the Stan probabilistic programming language directly to your data analysis environment.

What are the best practices for vectorization and non-centered parameterization in Stan?

Best practices for Stan include vectorization, non-centered parameterization, and target syntax. These workflow patterns optimize probabilistic programming performance and improve model diagnostics for Bayesian inference.

Does Stan work with R for Bayesian inference and statistical modeling?

Stan works with R through the cmdstanr package for Bayesian inference. This integration enables researchers to compile, sample, and diagnose statistical models directly within their R data analysis workflow.

Why do I need model diagnostics when writing Stan programs?

Model diagnostics are essential when writing Stan programs to validate Bayesian inference results. They help audit statistical modeling outputs by identifying convergence issues and verifying probabilistic program correctness.