0

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?

A Doe
  • 301
  • 2
  • 14
  • Can you just make `mu` a vector? Something like `mu[i-1] <- (Time[1:i] - Interval[1:i)*lambda`? – mfidino Jan 13 '21 at 13:58
  • 1
    both `mu` and `Prob` are getting re-defined as they are in the `i` loop, but they are not indexed. It looks as though you're trying to change the dimension of `Prob` for each different `i` - that won't work. – DaveArmstrong Jan 23 '21 at 20:13

0 Answers0