Skip to content

spencerpease-classes/statistical-rethinking

Repository files navigation

Statistical Rethinking: Rethought

A repository of worked problems and examples from Statistical Rethinking, 2nd Edition (McElreath, 2020), mainly in Julia and R.

Introduction

This repository was created out of a desire to better understand Bayesian statistics by learning from Richard McElreath's Statistical Rethinking textbook. Here, you will find (in progress!) worked problems and example from the text. Statistical Rethinking's language of choice is R, but this repo also attempts to replicate some of the book using Julia.

Structure

The code in this repo is organized by book chapter. Within each chapter folder is code for both the textbook examples and problems, in each language.

Chapters

  1. The Golem of Prague (no code)
  2. Small Worlds and Large Worlds

Environments

The programming environments used to work through Statistical Rethinking can be recreated using the following methods:

R

The R environment is managed with renv. To recreate the environment locally, simply open statistical-rethinking.Rproj in Rstudio then run:

renv::restore()

and the rest should be taken care of. One pacakge, Rstan, may require additional setup described on the Rstan Getting Started Wiki. Another package of note is the companion package for this textbook: rethinking.

Juila

The Julia environment is managed by the native package manager and included Project.toml file. The environment can be activated by setting Julia's working directory to this repo then running either:

julia> using Pkg; Pkg.activate(pwd()) # From the Julia REPL

or

pkg> activate . # From the package REPL (type `]` in the Julia REPL)

Note: this repository uses the 2nd edition of the book, published in March, 2020.

About

Worked problems and examples from Statistical Rethinking

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published