# [R] Calculating DIC from MCMC output

Kyle Edwards kedwards at ucdavis.edu
Tue Apr 3 04:07:51 CEST 2007

```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?

Thanks,

Kyle

```