Learning rjags using simple statistical models

Here are some examples of fitting simple statistical models in rjags. They are useful for beginners learning Bayesian inference using the rjags library. Notice in each case all that is required is specification of the probability density function for the observed data (i.e. the likelihood function) and the prior distribution functions for the unknown parameters.

Beyond that the user needs to be familiar with the rjags syntax for compiling the model, running the MCMC algorithm, sampling from the posterior distribution and examining the sample. The mcmcplots library is necessary for the last step.

These example programs were first written in WinBUGS by Lawrence Joseph. They were reprogrammed using R Markdown by Mandy Yao.