Search code examples
rjagsrunjags

DIC and PED when running JAGS parallely


I am running JAGS in parallel, i.e. each chain in separate process/thread. I am calling run.jags(..., method = "rjparallel", params = c(..., "dic", "ped")). I get the following error:

jags The DIC, PED, pD, full.pD and pOpt cannot be assessed when using parallel or separate chains

Hmmm....

  1. Is it because DIC and PED are computed from all the chains, not just one? Couldn't it be done in the run.jags function after collecting the results from all of the threads?

  2. Is there any way around that? How can I get DIC and PED while having parallel run? It must be possible somehow, right?


Solution

  • The answer provided by @M_Fidino is quite correct, but I will just a technical aspect of the question that this answer did not address - i.e.:

    1. Is there any way around that? How can I get DIC and PED while having parallel run? It must be possible somehow, right?

    JAGS calculates the penalty term for both DIC and PED using an estimate of the Kullback–Leibler divergence between chains at each iteration for each observed stochastic variable. The majority of the information required to calculate this outside of JAGS is not stored, and while it could in principle be stored to a file by JAGS this would get quite large quite quickly (at least when the number of observations is reasonably large). So it isn't done, and there are no plans to make it do so, so the short answer to your question is 'No, sorry'.

    Note however that calculation of 'pD' (and therefore 'DIC') differs depending on who you ask - and some methods of estimating pD do not require multiple chains. See also:

    JAGS and WinBUGS giving differing DIC

    Finally, there will be some improvements in DIC/PED/WAIC monitors in JAGS version 5 - and the WAIC monitors will not require multiple chains within the same simulation.

    Matt