rstan-to-pystan

Convert RStan code to PyStan 3.x with API and hyperparameter mapping.

134|21|Updated Nov 12, 2025
One-click install
npx skills add https://github.com/letta-ai/skills --skill rstan-to-pystan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rstan-to-pystan
Source: https://github.com/letta-ai/skills/tree/main/ai/benchmarks/letta/terminal-bench-2/trajectory-feedback/rstan-to-pystan
Command: npx skills add https://github.com/letta-ai/skills --skill rstan-to-pystan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides guidance for translating RStan (R interface to Stan) code to PyStan (Python interface), focusing on API differences, hyperparameter mapping, and output handling between the two ecosystems.

Core Features & Use Cases

  • Identify Stan model code compatibility across R and Python wrappers
  • Map hyperparameters (iter, warmup, chains, seed) to PyStan 3.x equivalents
  • Convert data preparation and sampling calls to PyStan patterns
  • Validate produced samples and output formats

Quick Start

Convert a simple RStan model call to PyStan 3.x code, ensuring the Stan model block remains unchanged.

Frequently Asked Questions about rstan-to-pystan

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

FAQPage Schema
How do I convert RStan code to PyStan 3.x?

Converting RStan to PyStan involves translating your Stan model (which remains unchanged), mapping hyperparameters like iter, warmup, chains, and seed to PyStan 3.x equivalents, and adapting data preparation and sampling calls to PyStan patterns. Validate sample outputs and formats match across the migration.

What hyperparameters change when migrating from RStan to PyStan?

RStan hyperparameters like iter, warmup, chains, and seed map directly to PyStan 3.x, but their argument names and API structure differ between the two interfaces. The Skill maps these equivalents so your sampling configuration produces consistent results in Python.

Can I reuse my Stan model files when switching from R to Python?

Yes. Stan model blocks remain identical across RStan and PyStan; only the wrapper code and API calls change. Your .stan files don't require modification—you adapt how you instantiate, configure, and sample from the model in Python.

How do I validate that my PyStan migration produces the same results as RStan?

Migration includes consistency checks on sample extraction and output formats. Compare posterior distributions, effective sample sizes, and diagnostic metrics between RStan and PyStan runs to confirm the conversion preserved modeling behavior and numerical results.

What data preparation changes are needed for PyStan?

Data dictionaries and input formats differ between RStan and PyStan 3.x. The migration process reconciles how you structure and pass data to the model, ensuring PyStan's data interface receives properly formatted inputs that match your Stan model's data block.

Does PyStan 3.x support all RStan sampling options?

PyStan 3.x covers core RStan functionality, but API differences exist in configuration and method names. Pre-conversion validation identifies incompatibilities and confirms your RStan workflow has a supported PyStan equivalent before full translation.