#JAGS model for Bayesian analysis #Pedro 05/25/2015 model { ## Priors for fixed effects Betas1 ~ dnorm(0,0.0001) Betas2 ~ dnorm(0,0.0001) ## Priors for random intercepts & slopes for (k in 1:Npop) { alpha.p[k] ~ dnorm(0,tau.plot.a) beta.p[k] ~ dnorm(0,tau.plot.b)} ## Priors for random error tau.plot.a <- 1/(sigma.plot.a*sigma.plot.a) tau.plot.b <- 1/(sigma.plot.b*sigma.plot.b) tau.eps <- 1/(sigma.eps*sigma.eps) sigma.plot.a ~ dunif(0.001,10) sigma.plot.b ~ dunif(0.001,10) sigma.eps ~ dunif(0.001,10) ## Likelihood for(i in 1:N){ Y[i] ~ dnorm(mu[i],tau.eps) mu[i] <- eta[i] eta[i] <- Betas1 + (Betas2 + beta.p[pp[i]]) *X[i] + alpha.p[pp[i]]} }