"Error: Attempt to redefine node" in Mixture that changes size every iteration

73 Views Asked by At

My data has three columns Time, Interval, Count. I have a mixture of Poissons that goes like this

mod_string = " model{

for(i in 2:length(Count)){

Count[i] ~ dpois(lambda.hacked[i]*z[i]+0.0001)
z[i] ~dbern(p)
lambda.hacked[i] <- mu[ clust[i] ]
Prob <- p^-(1:i) * (1-p) / p
mu <- (Time[1:i] - Interval[1:i])*lambda
clust[i] ~ dcat( Prob)

}

## Priors

lambda ~ dgamma(0.01,0.02)
p ~ dbeta(1,1)
}"

mu changes size at every iteration. As i grows, the number of clusters also grows.

How can I adapt this?

0

There are 0 best solutions below