Hello. I am running a state space model (the example from Marc kery's Bayesian population analysis using WinBUGS ) The code runs fine for the examle as shown in the book. However I played around and changed the nodes monitored to the latent variable z I get the following error- even though it is monitored in the code: Initializing model |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% Error in jags.samples(model, variable.names, n.iter, thin, type = "trace", : Failed to set trace monitor for z Node not found The code is: model { # Priors and constraints for (i in 1:nind){ for (t in f[i]:(n.occasions-1)){ phi[i,t] <- alpha[t] p[i,t] <- beta[t] } #t } #i for (t in 1:n.occasions-1) { alpha[t] ~ dbeta(1, 1) # Prior for mean survival beta[t] ~ dbeta(1, 1) # Prior for mean recapture } # Prior for mean recapture # Likelihood for (i in 1:nind){ # Define latent state at first capture z[i,f[i]] <- 1 for (t in (f[i]+1):n.occasions){ # State process z[i,t] ~ dbern(mu1[i,t]) mu1[i,t] <- phi[i,t-1] * z[i,t-1] # Observation process y[i,t] ~ dbern(mu2[i,t]) mu2[i,t] <- p[i,t-1] * z[i,t] } #t } #i } ni <- 10000 nt <- 6 nb <- 5000 nc <- 3 cjs.ran <- jags.model(file="cjs22time.jags",data=bugs.data, n.chains nc,n.adapt=2000) coda.cjs<-coda.samples(cjs.ran,c("z"),n.iter=5000,thin=5) Any idea why would not trace z node? Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Error-in-JAGS-cannot-monitor-z-tp4333685p4333685.html Sent from the R help mailing list archive at Nabble.com.