node.js - RJAGS output Node inconsistent with parents -


hi i'm new in jags , doing bayesian inference using mcmc through rjags. i've been trying best debug code until i'm stuck error "error in node e1[3] node inconsistent parents".

e1<-c(1,1,0,1,1,0,0,1,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,0,0,1,1,1,1,0,1) e2<-c(1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,1,1,0,1,1,0,1,1,0,0,1,1,1,0,1,1,0,1,1,1,1,1) c1<-c(2412,3485,881,1515,1824,1603,865,2638,332013,7379,1,1189,1,106,278,1406,9408,21596,15880,833,543,611,272,7883,       1,15091,11642,849,203,566,425,1,125124,687196,21377,3901,1131,543,1,21218,1118,5519,434800,1288,4700,820,659,6644,       1198,3581,1013,1021,5877,833,1,11797) c2<-c(1189,905,902,1154,20896,14973,1665,1,1096,309,641,1,935,282,       1,566,2245,112,18366,1096,1476,1,2486,1131,607,67,19390,284,       641,566,1154,1,2672,4857,1131,1231,4594,655,1127,4187,1223,417,       3381,1,1006,1,1920,4964,1911,765 ,876,14,942,849,4130) n<-c(56,55)  model<-function() {   #control   for(i in 1:n[1]){     e1[i] ~ dbern(p1[i])     c1[i] ~ dlnorm(eta[1],lambda[1])     p1[i] <- ilogit(alpha[1]+beta[1]*c1[i])   }   #treatment   for(i in 1:n[2]){     e2[i] ~ dbern(p2[i])     c2[i] ~ dlnorm(eta[2],lambda[2])     p2[i] <- ilogit(alpha[2]+beta[2]*c2[i])   }    (t in 1:2) {     eta[t] ~ dgamma(9,2)     lambda[t] ~ dunif(0,100)     alpha[t] ~ dnorm(0,1)     beta[t] ~ ddexp(0, gamma)     }  gamma ~ dunif(1,10) }  library(r2jags) datajags <- list("n","c1","c2","e1","e2")  params <- c("eta","lambda","alpha","beta") inits <- function(){   list(eta=runif(2,0,1),lambda=runif(2,0,1),alpha=runif(2,0,1),beta=runif(2,0,1)   ) } n.iter <- 10000 n.burnin <- 5000 n.thin <- floor((n.iter-n.burnin)/500) flxpin <- jags(datajags, inits, params, model.file=model,                n.chains=3, n.iter, n.burnin, n.thin,                dic=true, progress.bar="text") 

i hope can give me how debug this. lot.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -