I run a similar script in R, but it seems that OK, setting prior of the b
How is your prior of b setting?
Has your MCMC chain already converged?
PS: I tried something as below as you set b as fixed. But I also tried some other prior of b, it is OK.
N <- 100
x <- rgamma(N, 5, 1)
write("
model {
for (i in 1:length(x)) {
x[i] ~ dgamma(a, b)
}
a ~ dgamma(3, 1)
b <- 1
}",
file="example1.bug")
jags <- jags.model('example1.bug',
data = list('x' = x),
n.chains = 4,
n.adapt = 100)
mcmc.samples <- coda.samples(jags,
c('a', "b"),
n.iter = 10000)
summary(mcmc.samples)