# Marginal likelihood

In Bayesian probability theory, a marginal likelihood function is a likelihood function integrated over some variables, typically model parameters. Integrated likelihood is a synonym for marginal likelihood. Evidence is also sometimes used as a synonym, but this usage is somewhat idiosyncratic. "Marginal likelihood" is the most commonly-used of these three terms.

For any likelihood function of two or more variables, marginal likelihoods with respect to any subset of the variables can be defined. Let a denote the subset of variables marginalized (i.e., integrated). Let b denote the other variables. Let x denote observed data. Given the likelihood function p(x|a, b), the marginal likelihood of b is

${\displaystyle p(x|b)=\int p(x|a,b)\,p(a|b)\,da}$

where p(a|b) is the distribution of a conditional on b. The marginal likelihood of a is computed in an analogous way, by exchanging the roles of a and b.

In a widely-used application, the marginalized variables are parameters for a particular type of model, and the remaining variable is the identity of the model itself. In this case, the marginalized likelihood is the probability of the data given the model type, not assuming any particular model parameters. Writing θ for the model parameters, the marginal likelihood for the model M is

${\displaystyle p(x|M)=\int p(x|\theta ,M)\,p(\theta |M)\,d\theta }$

This quantity is important because the posterior odds ratio for a model M1 against another model M2 involves a ratio of marginal likelihoods, the so-called Bayes factor:

${\displaystyle {\frac {p(M_{1}|x)}{p(M_{2}|x)}}={\frac {p(M_{1})}{p(M_{2})}}\,{\frac {p(x|M_{1})}{p(x|M_{2})}}}$

which can be stated schematically as

${\displaystyle {\mbox{(posterior odds)}}={\mbox{(prior odds)}}\,\times \,{\mbox{(Bayes factor)}}}$

The Bayes factor is an object of central importance in Bayesian model comparison.

Unfortunately, marginal likelihoods are generally difficult to compute. Exact solutions are known for a small class of distributions. In general, some kind of numerical integration method is needed, either a general method such as Gaussian integration or a Monte Carlo method, or a method specialized to statistical problems such as the Laplace approximation or Gibbs sampling.