Science Magazine

Bayesian Model Comparison Part 2

Posted on the 11 May 2013 by Ccc1685 @ccc1685

In a previous post, I summarized the Bayesian approach to model comparison, which requires the calculation of the Bayes factor between two models. Here I will show one computational approach that I use called thermodynamic integration borrowed from molecular dynamics. Recall, that we need to compute the model likelihood function

P(D|M)=\int P((D|M,\theta)P(\theta|M) d\theta
    (1)

for each model where

P(D|M,\theta)
is just the parameter dependent likelihood function we used to find the posterior probabilities for the parameters of the model.

The integration over the parameters can be accomplished using the Markov Chain Monte Carlo, which I summarized previously here. We will start by defining the partition function

Z(\beta) = \int P(D|M,\theta)^\beta P(\theta| M) d\theta
   (2)

where

\beta
is an inverse temperature. The derivative of the log of the partition function gives

\frac{d}{d\beta}\ln Z(\beta)=\frac{\int d\theta \ln[P(D |\theta,M)] P(D | \theta, M)^\beta P(\theta|M)}{\int d\theta \ P(D | \theta, M)^\beta P(\theta | M)}
   (3)

which is equal to the ensemble average of

\ln P(D|\theta,M)
. However, if we assume that the MCMC has reached stationarity then we can replace the ensemble average with a time average 
\frac{1}{T}\sum_{i=1}^T \ln P(D|\theta, M)
.  Integrating (3) over
\beta
from 0 to 1 gives

Z(1) =Z(0) + \int \langle \ln P(D|M,\theta)\rangle d\beta

From (1) and (2), we see that  

Z(1)=P(D|M)
, which is what we want to compute  and
Z(0)=\int P(\theta|M) d\theta=1
.

Hence, to perform Bayesian model comparison, we simply run the MCMC for each model at different temperatures (i.e. use

P(D|M,\theta)^\beta
as the likelihood in the standard MCMC) and then integrate the log likelihoods
Z(1)
over
\beta
at the end. For a Gaussian likelihood function, changing temperature is equivalent to changing the data “error”. The higher the temperature the larger the presumed error. In practice, I usually run at seven to ten different values of
\beta
and use a simple trapezoidal rule to integrate over
\beta
.  I can even do parameter inference and model comparison in the same MCMC run.


Back to Featured Articles on Logo Paperblog

Magazine