# Contributing Stan code translations of McElreath's Statistical Rethinking examples

**URL:** <https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830>\
**Category:** Project Proposals\
**Created:** [October 1, 2018, 6:23pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830 "2018-10-01T18:23:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssp3nc3r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ssp3nc3r/32/120_2.png) [@ssp3nc3r](https://discourse.mc-stan.org/u/ssp3nc3r)\
**Post date:** [October 1, 2018, 6:23pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830/1 "2018-10-01T18:23:16Z")

</div>

McElreath’s Statistical Rethinking provides a function to see the Stan code behind his convenience functions (`rethinking::stancode()`), but he doesn’t focus on how to work directly with `stanfit` objects.

As an exercise, I have translated the examples from his book directly into Stan code, and extracted the information from stanfit objects using R and tidyverse/ggplot2 to recreate McElreath’s graphics too.

The code is organized in R Markdown files by chapter. I’d be happy to contribute.

---

<div class="post-metadata">

**Author:** ![richard\_mcelreath](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/richard_mcelreath/32/107_2.png) [@richard\_mcelreath](https://discourse.mc-stan.org/u/richard_mcelreath)\
**Post date:** [October 1, 2018, 6:31pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830/2 "2018-10-01T18:31:31Z")

</div>

I would love to link to this from my book homepage. Lots of added value.

---

<div class="post-metadata">

**Author:** ![ssp3nc3r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ssp3nc3r/32/120_2.png) [@ssp3nc3r](https://discourse.mc-stan.org/u/ssp3nc3r)\
**Post date:** [October 3, 2018, 7:15pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830/3 "2018-10-03T19:15:49Z")

</div>

Cool. I’ve made the Github repo public:

[https://github.com/ssp3nc3r/rethinking](https://github.com/ssp3nc3r/rethinking)

---

<div class="post-metadata">

**Author:** ![Bob\_Carpenter](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/bob_carpenter/32/9230_2.png) [@Bob\_Carpenter](https://discourse.mc-stan.org/u/Bob_Carpenter)\
**Post date:** [November 4, 2018, 11:36pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830/4 "2018-11-04T23:36:56Z")

</div>

Neat—thanks for sharing!

---

<div class="post-metadata">

**Author:** ![Grey2020](https://avatars.discourse-cdn.com/v4/letter/g/ba9def/32.png) [@Grey2020](https://discourse.mc-stan.org/u/Grey2020)\
**Post date:** [May 14, 2020, 5:59pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830/5 "2020-05-14T17:59:44Z")

</div>

ssp3nc3r–I have found the your stan code for Statistical Rethinking extremely valuable. However there is a new version out. Do you know of any place were stan code for the new edition can be found?

Thanks!

---

<div class="post-metadata">

**Author:** ![ssp3nc3r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/ssp3nc3r/32/120_2.png) [@ssp3nc3r](https://discourse.mc-stan.org/u/ssp3nc3r)\
**Post date:** [May 14, 2020, 9:35pm UTC](https://discourse.mc-stan.org/t/contributing-stan-code-translations-of-mcelreaths-statistical-rethinking-examples/5830/6 "2020-05-14T21:35:30Z")

</div>

It’s on my todo list. I’ve started a repo for his second edition:

> **[ssp3nc3r/rethinking2](https://github.com/ssp3nc3r/rethinking2)**
>
> Direct Stan code for second edition of McElreath's Statistical Rethinking - ssp3nc3r/rethinking2
