Solution (source code)

= Solution

Let $\overline\theta=\mathbb E(\theta\mid y)$ and $\overline D=\mathbb E\{D(\theta)\mid y\}$. The usual <effective parameter count in DIC> is
$$
\boxed{p_D=\overline D-D(\overline\theta).}
$$
With the locally flat <prior distribution>, $\overline\theta\approx\widehat\theta$ and the mean of the <chi-squared distribution> excess is $p$. Thus $\overline D\approx D(\widehat\theta)+p$, while $D(\overline\theta)\approx D(\widehat\theta)$, giving \b[$p_D\approx p$].

More generally, the <quadratic posterior deviance moments> give the effective count. Within the same approximation, let the <posterior covariance matrix> be $\Sigma$. The expectation of a <quadratic form> gives
$$
\overline D\approx D(\widehat\theta)+(\overline\theta-\widehat\theta)^TJ(\overline\theta-\widehat\theta)+\operatorname{tr}(J\Sigma),
$$
whereas evaluation at $\overline\theta$ omits the trace term. Therefore $p_D\approx\operatorname{tr}(J\Sigma)$. For a flat prior, $\Sigma\approx J^{-1}$ and the trace is $p$; informative prior shrinkage can reduce this effective count.