JAGS model run time error

I am trying to perform a Bayesian analysis using this model y ∼ Pois(λ) λ∼ Ga (10, 1) but getting a run time error:

y = c(10, 8, 8, 11, 7,5, 9, 8, 7, 8, 13, 11, 7, 9, 6, 10, 8, 9, 7, 9)

data = list(y = y, n = length(y))

init = list(mu = 1)

modelstring = "
model {
  for(i in 1 : n){
    y[i] ~ dpois(mu,1)
    mu <- n*lambda
  }
  lambda ~ dgamma(0, 1 / 10)
}
"
model = jags.model(textConnection(modelstring), data = data, inits = init, n.chains = 2, n.adapt = 1000)

Error in jags.model(textConnection(modelstring), data = data, inits = init,  : 
  RUNTIME ERROR:
Incorrect number of parameters in distribution dpois

The dpois() distribution only has one parameter. I found this in the JAGS user manual for version 4.3.0

The Poisson distribution (named after the French mathematician Simeon Denis Poisson 1781–1840) with rate λ (lambda) is defined by
y ~ dpois(lambda)
forλ >0.

What is the intention of having the 1 after mu in

y[i] ~ dpois(mu,1)
1 Like

issue has been sorted. thanks for pointing this out.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.