I think I found a crucial bug in jags.R; after creating the JAGS object (via jags.model), the current code proceeds to an adaptation phase (via rjags::adapt). But this doesn't store the simulations and so, effectively, there is no burnin considered in a R2jags run. For some models this is a problem because the resulting simulations are not at convergence and so they show massive variance in the node deviance (with typically a handful of outlier, with very large values). Other monitored notes may also show this artificial problem.
Also, I have renamed the variable pD to pV, because that's effectively what it is, in the JAGS computation (= var(deviance)/2). I have also added the possibility of computing the "proper" pD, via a call to rjags::dic.samples() and then modified the print method.
I have done some tests and, for the model that was showing problems, now R2jags works and give the correct results. The table and objects generated by jags.R are OK with the change in notation for pD/pV.
I think I found a crucial bug in
jags.R
; after creating the JAGS object (viajags.model
), the current code proceeds to an adaptation phase (viarjags::adapt
). But this doesn't store the simulations and so, effectively, there is no burnin considered in aR2jags
run. For some models this is a problem because the resulting simulations are not at convergence and so they show massive variance in the nodedeviance
(with typically a handful of outlier, with very large values). Other monitored notes may also show this artificial problem.Also, I have renamed the variable
pD
topV
, because that's effectively what it is, in the JAGS computation (= var(deviance)/2). I have also added the possibility of computing the "proper"pD
, via a call torjags::dic.samples()
and then modified theprint
method.I have done some tests and, for the model that was showing problems, now
R2jags
works and give the correct results. The table and objects generated byjags.R
are OK with the change in notation forpD
/pV
.