## Bayesian Analysis

- Bayesian Anal.
- Volume 7, Number 3 (2012), 737-770.

### Computing the Bayes Factor from a Markov Chain Monte Carlo Simulation of the Posterior Distribution

#### Abstract

Determining the marginal likelihood from a simulated posterior distribution is central to Bayesian model selection but is computationally challenging. The often-used harmonic mean approximation (HMA) makes no prior assumptions about the character of the distribution but tends to be inconsistent. The Laplace approximation is stable but makes strong, and often inappropriate, assumptions about the shape of the posterior distribution. Here, I argue that the marginal likelihood can be reliably computed from a posterior sample using Lebesgue integration theory in one of two ways: 1) when the HMA integral exists, compute the measure function numerically and analyze the resulting quadrature to control error; 2) compute the measure function numerically for the marginal likelihood integral itself using a space-partitioning tree, followed by quadrature. The first algorithm automatically eliminates the part of the sample that contributes large truncation error in the HMA. Moreover, it provides a simple graphical test for the existence of the HMA integral. The second algorithm uses the posterior sample to assign probability to a partition of the sample space and performs the marginal likelihood integral directly. It uses the posterior sample to discover and tessellate the subset of the sample space that was explored and uses quantiles to compute a representative field value. When integrating directly, this space may be trimmed to remove regions with low probability density and thereby improve accuracy. This second algorithm is consistent for all proper distributions. Error analysis provides some diagnostics on the numerical condition of the results in both cases.

#### Article information

**Source**

Bayesian Anal. Volume 7, Number 3 (2012), 737-770.

**Dates**

First available in Project Euclid: 28 August 2012

**Permanent link to this document**

https://projecteuclid.org/euclid.ba/1346158782

**Digital Object Identifier**

doi:10.1214/12-BA725

**Mathematical Reviews number (MathSciNet)**

MR2981634

**Zentralblatt MATH identifier**

1330.62159

**Keywords**

Bayesian computation marginal likelihood algorithm Bayes factors model selection

#### Citation

Weinberg, Martin D. Computing the Bayes Factor from a Markov Chain Monte Carlo Simulation of the Posterior Distribution. Bayesian Anal. 7 (2012), no. 3, 737--770. doi:10.1214/12-BA725. https://projecteuclid.org/euclid.ba/1346158782