I'm trying to understand how JAGS calculates deviance and the Deviance Information Criterion (DIC).
The dic.samples
function in rjags
in R throws an error if you have only one chain.
stop("2 or more parallel chains required")
The formula for calculating DIC involves calculating the expected deviance and the deviance at the expected values of the parameters in the model. I imagine such estimates could be obtained from a single chain (albeit there might sometimes be convergence issues that can only be identified with more than one chain).
The manual states that:
The pD monitor estimates the contribution to the effective number of parameters (pD) [3] from an observed stochastic node by comparing the deviance deviance across multiple chains [1]. It is created by using the option type(pD). If the model has only one chain then a pD monitor cannot be defined.
So my question is:
There are a number of different ways to calculate pD - the method that JAGS uses is described by Martyn Plummer in the Discussion to the 'Bayesian measures of model complexity and fit' paper: http://onlinelibrary.wiley.com/doi/10.1111/1467-9868.00353/abstract
Get the PDF and then do a search for 'Plummer' - the first result gives the details of the calculation used in JAGS.