Publishable Stuff

Rasmus Bååth's Blog


Beginners Exercise: Bayesian Computation with Stan and Farmer Jöns

2017-01-15

Over the last two years I’ve occasionally been giving a very basic tutorial to Bayesian statistics using R and Stan. At the end of the tutorial I hand out an exercise for those that want to flex their newly acquired skills. I call this exercise Bayesian computation with Stan and Farmer Jöns and it’s pretty cool! Now, it’s not cool because of me, but because the expressiveness of Stan allowed me to write a small number of data analytic questions that quickly takes you from running a simple binomial model up to running a linear regression. Throughout the exercise you work with the same model code and each question just requires you to make a minimal change to this code, yet you will cover most models taught in a basic statistics course! Well, briefly at least… :) If you want to try out this exercise yourself, or use it for some other purpose, you can find it here:

Beginners Exercise: Bayesian computation with Stan and Farmer Jöns (R-markdown source)
Solutions to Bayesian computation with Stan and Farmer Jöns (R-markdown source)

My friend and colleague Christophe Carvenius also helped me translate this exercise into Python:

Python Beginners Exercise: Bayesian computation with Stan and Farmer Jöns
Python Solutions to Bayesian computation with Stan and Farmer Jöns

Now, this exercise would surely have been better if I’d used real data, but unfortunately I couldn’t find enough datasets related to cows… Finally, here is a depiction of farmer Jöns and his two lazy siblings by the great master Hokusai.

Posted by Rasmus Bååth | 2017-01-15 | Tags: R, Statistics, Bayesian