function to run JAGS model