# How to calculate likelihood for a bayesian model?

I am trying to do Bayesian posterior predictive checking, whereby I calculate the DIC for my fitted model, and compare to DIC from data simulated from the fitted model. I can get the DIC out of winBUGS, however I am not sure how to calculate the likelihood (for the DIC) outside of winBUGS (i.e., without fitting new models). All of the literature is quite general with respect to discrepancy functions for model checking, and have notation like p(D|theta) which I understand, but doesn't help me when I want to actually do the calculation.

Given a set of parameter values, and a Y_rep data set - how do I calculate the likelihood?

-

The likelihood is numerically equal to $\operatorname{P}(D\vert\theta)$, where D is the data vector and theta the parameter vector. Well, strictly speaking it's only equal up to a multiplicative factor, but most software packages including WinBUGS define it as being equal - see Q1 of their FAQ on DIC. The distinction between likelihood and probability is made because instead of the probability of the data for given values of the parameters, the likelihood is considered to be a function of the parameters for a fixed set of data.
$\operatorname{P}(D\vert\theta)$ depends on the model for the data. The simplest case is when the data are independent and identically distributed (iid), in which case $\operatorname{P}(D\vert\theta)$ becomes a product over all the data points, and therefore the log-likelihood is a sum over all the data points. The probability for each data point is calculated from the probability density function or probability mass function defined by your model.