# Calculating the Deviance Information Criterion for a Hierarchical Regression Model

I'm not entirely sure how to phrase this question but maybe some background information might help. I am using MATLAB to perform hierarchical bayesian regressions and so I really need to understand what exactly to calculate in order to obtain parameters I might be seeking.

I created a Gibbs sampler for a hierarchical bayesian regression model and have the code set up to calculate the relevant conditional distributions and whatnot.

What I'm trying to do now is to both understand and calculate the DIC parameter. I'm somewhat lost so I was hoping someone could clarify my understanding and address the following questions.

From what I understand, the DIC is equal to the following:

$DIC = -2$ log $p(y|\hat\theta_{Bayes}) + 2 p_{DIC}$

1) For the first term, I've seen this described as the average deviance but I'm still unsure as to exactly what this refers to. It seems like I need to take 2 times the log of the likelihood function evaluated at the posterior mean. Is this correct?

2) How exactly does one "calculate" a value for the likelihood function so as to take the logarithm of it? For the conditional distribution for the regression coefficients, I'm using a multivariate normal conjugate prior which gives me a multivariate normal posterior. So I don't really evaluate the likelihood directly.

Any clarification or assistance would be very much appreciated. Thanks!