Using JAGS and runjags
Although it's a bit silly to break out MCMC for the single-parameter career recommendation analysis that we discussed earlier, applying this method to this simple example will aid in understanding its usage for more complicated models.
In order to get started, you need to install a software program called JAGS, which stands for Just Another Gibbs Sampler (a Gibbs sampler is a type of MCMC sampler). This program is independent of R, but we will be using R packages to communicate with it. After installing JAGS, you will need to install the R packages rjags
, runjags
, and modeest
. As a reminder, you can install all three with this command:
> install.packages(c("rjags", "runjags", "modeest"))
To make sure everything is installed properly, load the runjags
package, and run the function testjags()
. My output looks something like this:
> library(runjags)
> testjags()
You are using R version 3.2.1 (2015-06-18) on a unix machine,
with the RStudio GUI
The...