Code from the text (redone)

I redid the examples from the book using a different coding style from that of the author.

I also use a slightly modified version of the rethinking package (available via https://github.com/rpruim/rethinking).