Random Effect in Zero-Inflated Model
FishModeler opened this issue · 0 comments
Hello! I am using a zero-inflated model. I need to add year as a random effect. I am having issues getting my model to run. Here is my current code:
PredatorFishCountL2<-rnorm(12067,.12,.23)
PreyFishCountL2<-rnorm(12067,.28,1.04)
yearr<-c(sample(1:12,12067,replace=TRUE))
FinalTBData2<-data.frame(PredatorFishCountL2,PreyFishCountL2,yearr)
Model1GTB<- ulam(
alist(
PredatorFishCountL2 ~ dzipois(pbar,lamba),
logit(pbar) <- z1,
log(lamba)<-a + d*PreyFishCountL2+a_yearr[yearr],
a ~ dnorm(0.26,0.44),
d ~ dnorm(1.3,2.5),
z1~rnorm(1.85,2.76),
a_yearr[yearr]dunif(6,sigma1),dunif(0,10)
sigma1
),
data =FinalTBData2,
start=list(z1=1,a=0,d=0),
iter=3000,warmup=2000,chains =3, cores = 6, log_lik = TRUE
)
I receive the following error:
Error in new_symbols[[left_name]]$dims[[1]] :
object of type 'symbol' is not subsettable
Any ideas? Thank you in advance:)