# No error error in OpenBUGS

The following code produce no output and no error code in the OpenBUGS log file. Here is the code:

var disqus_shortname = 'jarad'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
Please enable JavaScript to view the comments powered by Disqus.
blog comments powered by Disqus

kimodel <- function() { for (i in 1:N) { y[i] ~ dbin(p[i],1) logit(p[i]) <- b[ki[i],1]+b[ki[i],2]*dist[i] } for (k in 1:K) { b[k,1:2] ~ dmnorm(mu[1:2],Tau[1:2,1:2]) } for (j in 1:2) { mu[j] ~ dnorm(0.0,1.0E-6) } } fn <- file.path(tempdir(),"kimodel.txt") write.model(kimodel,fn) K <- 4 N <- 25*4 b <- matrix(rnorm(K*2),K,2) b[,2] <- 0 dist <- runif(N,18,60) ki <- rep(1:4,each=25) y <- rbinom(N,1,1/(1+exp(-b[ki,1]-b[ki,2]*dist))) data <- list(N=N,K=K,y=y,ki=ki,dist=dist, Tau=diag(2)) parameters <- c("b","mu") nburn=1e4 ki.sim <- bugs(data,NULL,parameters,fn,n.chains=1,n.burnin=nburn,n.thin=1,n.iter=nburn*2)Which produced the following log file:

OpenBUGS version 3.2.1 rev 781 type 'modelQuit()' to quit OpenBUGS> model is syntactically correct OpenBUGS> data loaded OpenBUGS> model compiled OpenBUGS> OpenBUGS> initial values generated, model initialized OpenBUGS>and error in R. Apparently the offending line was

for (j in 1:2) { mu[j] ~ dnorm(0.0,1.0E-6) }which works when the precision is 1.0E-1 but not when it is 1.0E-2 or by initializing with reasonable values for mu through the inits argument. Since inits=NULL, the chain was initialized with a draw from the distribution which was, apparently, too far in the tails for the algorithm to work well. The only piece that is unfortunate here is that no error was provided in the log file. In the future, I will certainly be aware of my initial values when developing OpenBUGS models.