Skip to content

A web app to visualize distributions in Stan. Uses Stan Math C++ compiled to Webassembly to evaluate the functions using actual Stan implementations. Uses d3.js for visualizations.

License

rok-cesnovar/stan-distributions

Repository files navigation

Stan distributions

A web app to visualize distributions in Stan. It uses Stan Math C++ code to evaluate the log probability density/mass functions. The Stan Math C++ is compiled to Webassembly using Emscripten. d3.js is used for visualizations.

This was inspired by the distribution zoo. The main differences of this approach are:

  • it runs entirely in the user's browser and does not require a server (very easy to fork and deploy your own custom version),
  • it uses the actual Stan C++ for all density/mass functions (Distribution zoo is based on R distribution implementations).

This currently supports the majority of Stan's univariate continuous distributions. Missing discrete distributions will be added shortly.

Links

Unbounded Continuous Distributions

Positive Continuous Distributions

Positive Lower-Bounded Distributions

Continuous Distributions on [0, 1]

Circular Distributions

Bounded Continuous Distributions

Unbounded Discrete Distributions

Custom distributions

Contributed by @noejn2.

Running it locally

  1. Clone the repository
git clone https://github.com/rok-cesnovar/stan-distributions/
  1. Start a simple Python server

This is required in order to serve the .wasm files. The actual computation still happens in the browser.

python3 -m http.server 8000
  1. Open localhost:8000 in your favorite browser. Change the port number in step 2 if needed.

About

A web app to visualize distributions in Stan. Uses Stan Math C++ compiled to Webassembly to evaluate the functions using actual Stan implementations. Uses d3.js for visualizations.

Topics

Resources

License

Stars

Watchers

Forks