Session Ready
Exercise

Multiple chains

Trace plots help us diagnose the quality of a Markov chain simulation. A "good" Markov chain will exhibit stability as the chain length increases and consistency across repeated simulations, or multiple chains. You will use RJAGS to run and construct trace plots for four parallel chains below. The defined sleep_model is in your workspace.

Instructions
100 XP
  • Use jags.model() to COMPILE sleep_model and initialize 4 parallel chains. Store the output in a jags object named sleep_jags_multi.

  • SIMULATE a sample of 1,000 draws from the posterior model of m and s. Store this mcmc.list in sleep_sim_multi.

  • Check out the head() of sleep_sim_multi. Note the 4 list items containing the 4 parallel chains.

  • Use plot() to construct trace plots for the multiple chains. Suppress the density plots.