This repo contains my attempt to reproduce the R code in the upcoming 3rd edition of Statistical Rethinking to Julia.
The MCMC engine will be Turing.jl and the notebooks are written with Quarto.
Code was originally inspired (and ported) from repo StatisticalRethinkingJulia/SR2TuringJupyter.jl.
Using Docker is recommended as it ensure reproducibility.
If you prefer to install locally, skip down.
Clone this repo (dantonnoriega/SR3TuringQuarto.jl.git
) and then pull the associated docker image (dantonnoriega/sr3-turing-quarto-jl
).
## clone and enter project directory
git clone git@github.com:dantonnoriega/SR3TuringQuarto.jl.git
cd SR3TuringQuarto.jl
## pull the docker image
docker pull dantonnoriega/sr3-turing-quarto-jl
After cloning the repo and pulling the docker image, you have two options:
- Run directly in VS Code via command
Dev Containers: Open Folder in Container...
- Spin up your own container then attach VS Code via command
Dev Containers: Attach to Running Container...
Start up Docker, open the Command Palette (F1
) in VS Code and run Dev Containers: Open Folder in Container...
.
That should be it!
Start up Docker then spin up (run) a container.
# assumes one is currently in ../SR3TuringQuarto.jl
docker run --rm -d -it -v $(pwd):/workspace/SR3TuringQuarto.jl dantonnoriega/sr3-turing-quarto-jl
One can then load up VS Code and attach to the running container (Command: Dev Container: Attach to Running Container...
).
To run the code in this repo, you need to have julia
and quarto
installed.
julia
can be easily installed on macOS using brew
# install julia
brew install --cask julia
For macOS using brew
# install quarto
brew install --cask quarto
# install librsvg (render svg in pdfs) and python3 (if not installed)
brew install librsvg python3
# need jupyter for python to render julia qmd pdfs
## !! be mindful about which python environment and version you're using (system vs brew vs pyenv vs conda etc)
python3 -m pip install jupyter
(optional) Set up quarto to properly render PDFs.
quarto install tinytex
After satisfying the Local Run Requirements above, you should be able to run and render the Quarto *.qmd
files in notebooks/
.
-
Clone this repo (
dantonnoriega/SR3TuringQuarto.jl.git
)## clone and enter project directory git clone git@github.com:dantonnoriega/SR3TuringQuarto.jl.git cd SR3TuringQuarto.jl
-
Run Julia and
activate
and theninstantiate
this project## start julia in your terminal julia
Within julia (
julia>
) you can then runusing Pkg Pkg.activate() Pkg.instantiate()
OR enter Pkg REPL by hitting
]
and run## hit "]" to enter Pkg REPL (https://pkgdocs.julialang.org/v1/getting-started/#Basic-Usage) activate . instantiate