I have developed a zero-inflated model. Without the year (yearr) as a random effect, it works fine.
Here is the code I currently have with generating some data similar to mine:
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),
sigma1~dunif(0,10)
),
data =FinalTBData2,
start=list(z1=1,a=0,d=0),
iter=3000,warmup=2000,chains =3, cores = 6, log_lik = TRUE
)
When I run this code, I receive this error: Error in new_symbols[[left_name]]$dims[[1]] : object of type 'symbol' is not subsettable
Any ideas? Thank you so much!