Introducing Stan Playground - A Web-Based Platform for Stan Programming and Collaboration

Hello everyone,

I’m excited to share a new piece of open-source software called Stan Playground. This is a web-based application that simplifies and streamlines the creation, execution, and sharing of Stan analyses. If you visit the site you can immediately get started browsing or creating Stan programs and analyses. I believe this tool will prove invaluable for education, demonstrations, prototyping, sharing/collaborating, and possibly even running computationally-intensive analyses. It caters to both beginners and experienced users.

Access the web app here:
(We’re in need of beta testers!)

Each Stan Playground Analysis (.spa) consists of a Stan program (.stan file) a dataset (.json file) and sampler run options. These analyses are grouped into Projects that can be managed through the web interface. Projects in turn are grouped into Workspaces which can be shared either publicly or with select users.

Begin by browsing the community Workspaces where you will be able to view the public Projects and .stan files together with the generated outputs that can be viewed using MCMC Monitor. The Gaussian Mixture example in the Example Gallery provides a particularly comprehensive example as it includes Python scripts for data preparation as well as basic post-processing of the output.

When you are ready to create your own analyses, you can authenticate using GitHub. Then you can either clone one of the community Projects into your own workspace, or create a new Project based on a template.

Stan Playground features a .stan file editor with syntax highlighting and automatic syntax error and warning detection together with an ‘auto format’ feature (leveraging the in-browser JavaScript version of stanc3 compiler). It also has AI integration so you can ask questions about your Stan program within the GUI.

After editing the Stan program and preparing a .json dataset, you can launch the sampler directly from the GUI. This runs Stan in the cloud. By default it uses our (limited) compute resources that are publicly available. For more lengthy or RAM/CPU-intensive runs, you can attach your own compute resources (i.e., run the sampler on your own machine). Essentially, you run a service on your computer or server which listens for job requests initiated in the GUI. It then executes those jobs in a container (docker or singularity) and uploads the results back to the cloud.

For dataset creation, you can either paste in the JSON directly, or use a Python script for data generation. The script can be executed in the cloud through the web interface and can generate simulated data or download existing datasets from the internet.

Once an analysis job is complete, you can run further Python scripts for post-processing, export to your computer, or view the output in MCMC Monitor. As mentioned above, the Gaussian Mixture is a simple example that demonstrates these post-processing features.

This software is still at an early stage, and we are seeking feedback!

Thank you to @Bob_Carpenter @JSoules @WardBrian and @andrewgelman for help and feedback during the initial development.

A couple screenshots:


Wow–this looks absolutely awesome! It’s something I’ve dreamed of for years.

Wow, this looks amazing! Pumped to try this out.