StatisticalRethinkingJulia / TuringModels.jl

Implementations of the models from the Statistical Rethinking book with Turing.jl
https://statisticalrethinkingjulia.github.io/TuringModels.jl/
MIT License
163 stars 18 forks source link
franklin julia-language mcmc statisticalrethinking turing turinglang

TuringModels

CI

Introduction

This package contains Julia versions of the mcmc models contained in the R package "rethinking" associated with the book Statistical Rethinking by Richard McElreath. It is part of the StatisticalRethinkingJulia Github organization of packages.

This package implements the models using TuringLang/Turing.jl.

Usage

Most of the scripts and output can be inspected via the website. If you want to run the scripts yourselves, then you can either

  1. copy the code from the webpages and the data from this repository, and run the scripts or
  2. clone this repository and run one of the files in scripts. For example, julia --project -i scripts/basic-example.jl.

The scripts are written in Literate.jl to allow them to be ran stand-alone, and as part of the website. To generate the website locally, use Franklin.jl. Specifically, clone this repository and go into the root directory of this repository. Then, use

julia --project -ie 'using Franklin; Franklin.serve()'

This will activate the project environment (thanks to the --project flag) and will interactively execute Franklin.serve(). Interactively means that if serve fails, then you will still be in an active REPL session which avoids having to completely restart Julia. Building the site for the first time will take about 20 minutes. After building the site, it will be available on http://localhost:8000/. Consecutive calls to serve will only take a few minutes because Franklin caches the output.

Versions

v2.0

v1.1.2

v1.1.1

v1.0.6

v1.0.5

v1.0.4

v1.0.3

v1.0.2

v1.0.1

v1.0.0

v0.5

Acknowledgements

Richard Torkar has taken the lead in developing the Turing versions of the models in chapter 8 and subsequent chapters. Martin Trapp has updated many models to recent versions of Turing.jl. Rik Huijzer is bringing the models in sync with the 2nd edition of the StatisticalRethinking book in addition to several other improvements. Thibaut Lienart has given advise on how to use Franklin well.

The TuringLang team and #turing contributors on Slack have been extremely helpful! The Turing examples by Cameron Pfiffer and others have been a great help.

Questions and issues

Question and contributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems or have a question.