stan-playground

A tour of Stan Playground

For users familiar with tools like the Compiler Explorer, repl.it or JSFiddle, Stan Playground hopes to provide a similar experience for Stan models.

map

1: Stan Editor

The site features an editor for Stan code with syntax highlighting, automatic formatting, and warnings and errors from the Stan compiler for instant feedback.

1: Stan Editor

2: Preparing Data

Data can be provided in JSON format in its own editor, or can be generated from code written in R (using webR) or Python (using pyodide), including code that imports published datasets.

2a: Data Editor 2b: Data Generation

3: Compiling and Running

3: Compilation button

Compilation of the models is the only part of Stan Playground which is not run locally. We provide a public server for convenience, but you can also host your own. This is controlled in settings (see section 6 below).

After a model has been compiled, sampling can be run entirely in your local browser. 3: Run controls

4: Viewing and analyzing results

Stan Playground has several built-in ways of viewing the samples, but also supports performing your own analysis, again in R or Python.

4: Draws 4: Histograms 4: Scatter Plots 4: Analysis.R

5: Sharing and saving your data

Stan Playground has built-in sharing features to allow you to download a copy of your project, upload an existing project, or share via a Github Gist. Sharing with a Gist provides a link you can send to other users–when clicked, the link loads your shared project in the recipient’s browser.

5: Export window 5: Load window

You can also prepare custom links if you have files already living at some URL (e.g., they are already in a github repository). For example, this link will load the “golf” case study from the Stan example models repository:

https://stan-playground.flatironinstitute.org/?title=Knitr%20-%20Golf%20-%20Golf%20Angle&stan=https://raw.githubusercontent.com/stan-dev/example-models/master/knitr/golf/golf_angle.stan&data=https://raw.githubusercontent.com/stan-dev/example-models/master/knitr/golf/golf1.data.json

6: Settings

The settings window allows you to control the compilation server used and some other user-settings, including a dark mode. 6: Settings 6: Dark mode