dantonnoriega / SR3TuringQuarto.jl

Porting the R code from the draft 3rd edition of Statistical Rethinking to Julia. Written in Quarto.

Home Page:https://dantonnoriega.github.io/SR3TuringQuarto.jl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[WIP] Statistical Rethinking (3rd edition) with Julia (Turing and Quarto)

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.

Run Requirements

Using Docker is recommended as it ensure reproducibility.

If you prefer to install locally, skip down.

Docker + VS Code

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:

  1. Run directly in VS Code via command Dev Containers: Open Folder in Container...
  2. Spin up your own container then attach VS Code via command Dev Containers: Attach to Running Container...

(1) Dev Containers: Open Folder in Container...

Start up Docker, open the Command Palette (F1) in VS Code and run Dev Containers: Open Folder in Container....

That should be it!

(2) Dev Containers: Attach to Running Container...

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...).

Local

To run the code in this repo, you need to have julia and quarto installed.

Julia

julia can be easily installed on macOS using brew

# install julia
brew install --cask julia

Quarto

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

Locally Run Quarto + Julia Notebooks

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 then instantiate this project

    ## start julia in your terminal
    julia

    Within julia (julia>) you can then run

    using 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

About

Porting the R code from the draft 3rd edition of Statistical Rethinking to Julia. Written in Quarto.

https://dantonnoriega.github.io/SR3TuringQuarto.jl/

License:MIT License


Languages

Language:Dockerfile 98.8%Language:CSS 1.2%