Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random Effect in Zero-Inflated Model #420

Open
FishModeler opened this issue Feb 6, 2024 · 0 comments
Open

Random Effect in Zero-Inflated Model #420

FishModeler opened this issue Feb 6, 2024 · 0 comments

Comments

@FishModeler
Copy link

FishModeler commented Feb 6, 2024

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),
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
)

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:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant