Re: [R] Calculating DIC from MCMC output

From: Duncan Murdoch <>
Date: Tue 03 Apr 2007 - 12:50:36 GMT

On 4/2/2007 10:07 PM, Kyle Edwards wrote:
> Greetings all,
> I'm a newcomer to Bayesian stats, and I'm trying to calculate the
> Deviance Information Criterion "by hand" from some MCMC output.
> However, having consulted several sources, I am left confused as to
> the exact terms to use. The most common formula can be written as
> DIC = 2*Mean(Deviance over the whole sampled posterior distribution)
> - Deviance(Mean posterior parameter values)
> However, I have also seen this as
> DIC = 2*Mean(Deviance over the whole sampled posterior distribution)
> - Min(Deviance over the whole sampled posterior)
> Now, my understanding is that for some distributions, the deviance at
> the parameter means will be equal to the minimum deviance (i.e. these
> are the maximum likelihood parameter values). But, in other cases
> this will not be true. I have also read that the choice of exactly
> which point estimate of the parameters to use is somewhat arbitrary
> (i.e. one could use the mean, the mode, the median). It would be much
> easier for me to analyze this data if I can just use the formula with
> Min(Deviance). Could anyone comment on the difference between these
> and recommend the best course?

The Spiegelhalter et al (2002) gives both of those as possibilities, as well as the posterior median. I don't have any experience with DIC to offer direct advice, but if you don't get any here, I can offer the indirect advice to ask on the BUGS mailing list, where David Spiegelhalter and Nicky Best are active. There's also some advice here: <>.

Duncan Murdoch mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Tue Apr 03 22:58:39 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 03 Apr 2007 - 13:30:44 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.