Let M1,…,MKM_1,\ldots,M_K be candidate models for the data x‾,\underline{x}, where model MkM_k has parameter θk∈Θk,\theta_k\in\Theta_k, likelihood f(x‾∣θk,Mk)f\left(\underline{x}\mid\theta_k,M_k\right) and prior π(θk∣Mk).\pi\left(\theta_k\mid M_k\right). Model uncertainty is uncertainty about which model generated the data. Bayesian inference treats model uncertainty like any other uncertainty by placing a prior model probability P(Mk)\mathbb{P}\left(M_k\right) on each model, with ∑k=1KP(Mk)=1.\sum_{k=1}^K\mathbb{P}\left(M_k\right)=1.

Let MkM_k be a model with parameter θk,\theta_k, likelihood f(x‾∣θk,Mk)f\left(\underline{x}\mid\theta_k,M_k\right) and prior π(θk∣Mk).\pi\left(\theta_k\mid M_k\right). The marginal likelihood of MkM_k is the probability it assigns to the observed data after integrating out its parameters.

f(x‾∣Mk):=∫Θkf(x‾∣θk,Mk)π(θk∣Mk)dθkf\left(\underline{x}\mid M_k\right):=\int_{\Theta_k}f\left(\underline{x}\mid\theta_k,M_k\right)\pi\left(\theta_k\mid M_k\right)d\theta_k

Let M1,…,MKM_1,\ldots,M_K be candidate models with prior model probabilities and marginal likelihoods. The posterior model probability of MkM_k is the conditional probability of MkM_k given the data, which follows from Bayes’ theorem.

P(Mk∣x‾)=f(x‾∣Mk)P(Mk)∑j=1Kf(x‾∣Mj)P(Mj)\mathbb{P}\left(M_k\mid\underline{x}\right)=\frac{f\left(\underline{x}\mid M_k\right)\mathbb{P}\left(M_k\right)}{\sum_{j=1}^K f\left(\underline{x}\mid M_j\right)\mathbb{P}\left(M_j\right)}

Let M1M_1 and M2M_2 be candidate models. The prior odds of M1M_1 over M2M_2 are P(M1)P(M2)\frac{\mathbb{P}\left(M_1\right)}{\mathbb{P}\left(M_2\right)} and the posterior odds of M1M_1 over M2M_2 are P(M1∣x‾)P(M2∣x‾).\frac{\mathbb{P}\left(M_1\mid\underline{x}\right)}{\mathbb{P}\left(M_2\mid\underline{x}\right)}.

Let M1M_1 and M2M_2 be candidate models. The Bayes factor in favour of M1M_1 over M2M_2 is the ratio of their marginal likelihoods, which is the factor by which the data update the prior odds into the posterior odds.

B12:=f(x‾∣M1)f(x‾∣M2)=P(M1∣x‾)/P(M2∣x‾)P(M1)/P(M2)B_{12}:=\frac{f\left(\underline{x}\mid M_1\right)}{f\left(\underline{x}\mid M_2\right)}=\frac{\mathbb{P}\left(M_1\mid\underline{x}\right)/\mathbb{P}\left(M_2\mid\underline{x}\right)}{\mathbb{P}\left(M_1\right)/\mathbb{P}\left(M_2\right)}

The Bayes factor has the following properties:

  • it measures the evidence the data provide for one model over the other independently of the prior model probabilities;
  • a Bayes factor of 11 is no evidence, and by convention values of B12B_{12} above about 3,3, 1010 and 100100 are read as positive, strong and decisive evidence for M1;M_1;
  • for two simple hypotheses the Bayes factor is the likelihood ratio;
  • a simple null hypothesis H0:θ=θ0H_0:\theta=\theta_0 is tested against H1:θ≠θ0H_1:\theta\neq\theta_0 by comparing the model with θ\theta fixed at θ0\theta_0 to the model with a prior on θ.\theta.

Occam’s razor is the property that the Bayes factor automatically penalises complexity. The marginal likelihood is the prior predictive density of the observed data, so it rewards a model for predicting the data well before seeing them. A model with more parameters or a more diffuse prior spreads its prior predictive distribution over more possible data sets and so assigns lower probability to any particular one unless the extra flexibility is needed.

The Jeffreys–Lindley paradox is the property that as the prior on θ\theta under H1H_1 becomes more diffuse the marginal likelihood of H1H_1 tends to zero and the Bayes factor favours H0H_0 whatever the data, even when a frequentist test rejects H0H_0 decisively. The Bayes factor is therefore sensitive to the prior on the parameters, and improper priors cannot be used for the parameters that differ between models, since the marginal likelihood is then defined only up to an arbitrary constant.

Let MkM_k be a model with dkd_k parameters and maximum likelihood estimate θ^k.\hat{\theta}_k. Marginal likelihoods are rarely available in closed form and are estimated by importance sampling or bridge sampling, or approximated using the Laplace approximation, which as n→∞n\rightarrow\infty gives

log⁡ef(x‾∣Mk)≈ℓ(θ^k∣x‾)−dk2log⁡en.\log_e f\left(\underline{x}\mid M_k\right)\approx\ell\left(\hat{\theta}_k\mid\underline{x}\right)-\frac{d_k}{2}\log_e n.

Let MkM_k be a model with dkd_k parameters and maximum likelihood estimate θ^k.\hat{\theta}_k. The Bayesian information criterion (BIC) of MkM_k is minus twice the Laplace approximation of its log marginal likelihood.

BICk:=−2 ℓ(θ^k∣x‾)+dklog⁡en\mathrm{BIC}_k:=-2\,\ell\left(\hat{\theta}_k\mid\underline{x}\right)+d_k\log_e n

The BIC has the following properties:

  • 12(BIC2−BIC1)≈log⁡eB12,\frac{1}{2}\left(\mathrm{BIC}_2-\mathrm{BIC}_1\right)\approx\log_e B_{12}, so the model with the smallest BIC has approximately the largest marginal likelihood;
  • it depends on the prior only through terms that do not grow with n;n;
  • it is consistent in the sense of selecting the true model with probability tending to one when it is among the candidates.

Let M1,…,MKM_1,\ldots,M_K be candidate models with posterior model probabilities, X~\tilde{X} be a future observation and Δ\Delta be a quantity that has the same meaning in every model, such as a prediction or an effect size. Bayesian model averaging (BMA) is the method that makes inferences and predictions by averaging over the models with their posterior probabilities as weights rather than conditioning on a single chosen model.

f(x~∣x‾)=∑k=1Kf(x~∣x‾,Mk)P(Mk∣x‾)f\left(\tilde{x}\mid\underline{x}\right)=\sum_{k=1}^K f\left(\tilde{x}\mid\underline{x},M_k\right)\mathbb{P}\left(M_k\mid\underline{x}\right) π(Δ∣x‾)=∑k=1Kπ(Δ∣x‾,Mk)P(Mk∣x‾)\pi\left(\Delta\mid\underline{x}\right)=\sum_{k=1}^K\pi\left(\Delta\mid\underline{x},M_k\right)\mathbb{P}\left(M_k\mid\underline{x}\right)

Bayesian model averaging has the following properties:

  • it propagates model uncertainty into the final inference, so its intervals are wider and better calibrated than those from the single best model;
  • its predictions have lower expected loss under the logarithmic score than those of any single model when the true model is among the candidates.

Model selection is the choice of a single model from the candidates. Model selection is the Bayes action under the zero-one loss that charges one unit for choosing any model other than the true one, which selects the model with the largest posterior probability, or equivalently the largest Bayes factor against each alternative when the prior model probabilities are equal. When no candidate model is believed to be true, models are instead compared by how well they predict new data.

Let MkM_k be a model and x~\tilde{x} be a new observation. The log predictive density of x~\tilde{x} under MkM_k is log⁡ef(x~∣x‾,Mk).\log_e f\left(\tilde{x}\mid\underline{x},M_k\right). The expected log predictive density of MkM_k is the expectation of the log predictive density over the true distribution of X~.\tilde{X}.

Let MkM_k be a model and x‾−i\underline{x}_{-i} be the data with the ii-th observation removed. Leave-one-out cross-validation is the method that estimates the expected log predictive density without new data by summing the log predictive densities of each observation given the others.

elpdloo:=∑i=1nlog⁡ef(xi∣x‾−i,Mk)\mathrm{elpd}_{\mathrm{loo}}:=\sum_{i=1}^n\log_e f\left(x_i\mid\underline{x}_{-i},M_k\right)

The expected log predictive density can also be approximated by an information criterion.

Let MM be a model with likelihood f(x‾∣θ).f\left(\underline{x}\mid\theta\right). The deviance of MM at parameter value θ\theta is minus twice the log-likelihood.

D(θ):=−2log⁡ef(x‾∣θ)D\left(\theta\right):=-2\log_e f\left(\underline{x}\mid\theta\right)

Let MM be a model with deviance DD and posterior distribution π(θ∣x‾).\pi\left(\theta\mid\underline{x}\right). The posterior mean deviance is D‾:=E[D(θ)∣x‾].\overline{D}:=\mathbb{E}\left[D\left(\theta\right)\mid\underline{x}\right]. The effective number of parameters is the difference between the posterior mean deviance and the deviance at the posterior mean.

pD:=D‾−D(E[θ∣x‾])p_D:=\overline{D}-D\left(\mathbb{E}\left[\theta\mid\underline{x}\right]\right)

Let MM be a model with posterior mean deviance D‾\overline{D} and effective number of parameters pD.p_D. The deviance information criterion (DIC) of MM is the posterior mean deviance plus the effective number of parameters.

DIC:=D‾+pD\mathrm{DIC}:=\overline{D}+p_D

The DIC is computed directly from posterior draws.

Let MM be a model with likelihood f(xi∣θ)f\left(x_i\mid\theta\right) for each observation and posterior distribution π(θ∣x‾).\pi\left(\theta\mid\underline{x}\right). The widely applicable information criterion (WAIC) of MM is minus twice the log pointwise predictive density minus the effective number of parameters, where the latter is the sum of the posterior variances of the pointwise log-likelihoods.

WAIC:=−2(∑i=1nlog⁡eE[f(xi∣θ)∣x‾]−∑i=1nvar[log⁡ef(xi∣θ)∣x‾])\mathrm{WAIC}:=-2\left(\sum_{i=1}^n\log_e\mathbb{E}\left[f\left(x_i\mid\theta\right)\mid\underline{x}\right]-\sum_{i=1}^n\mathrm{var}\left[\log_e f\left(x_i\mid\theta\right)\mid\underline{x}\right]\right)

Information criteria have the following properties:

  • the WAIC is a more stable alternative to the DIC and asymptotically equals −2 elpdloo;-2\,\mathrm{elpd}_{\mathrm{loo}};
  • lower values of DIC and WAIC indicate better expected predictive performance;
  • unlike the Bayes factor they are insensitive to diffuse priors and do not require the true model to be among the candidates;
  • they do not deliver posterior probabilities of the models.

Let x‾\underline{x} be the observed data with posterior distribution π(θ∣x‾).\pi\left(\theta\mid\underline{x}\right). A replicated data set is a hypothetical new data set x‾rep\underline{x}^{\mathrm{rep}} of the same size and structure as x‾\underline{x} drawn from the posterior predictive distribution.

f(x‾rep∣x‾)=∫Θf(x‾rep∣θ)π(θ∣x‾)dθf\left(\underline{x}^{\mathrm{rep}}\mid\underline{x}\right)=\int_{\Theta}f\left(\underline{x}^{\mathrm{rep}}\mid\theta\right)\pi\left(\theta\mid\underline{x}\right)d\theta

A replicated data set is simulated by drawing θ(s)\theta^{(s)} from the posterior and then x‾rep(s)\underline{x}^{\mathrm{rep}(s)} from the population distribution at θ(s).\theta^{(s)}.

Posterior predictive checking is the method that compares the observed data with replicated data sets. If the model is adequate then the observed data should look like a typical draw from the posterior predictive distribution. Model comparison only ranks the candidates, so a model should also be checked against the data on its own.

Let x‾\underline{x} be data and θ\theta be a parameter. A test quantity is a function T(x‾,θ)T\left(\underline{x},\theta\right) of the data, and possibly the parameter, chosen to capture a feature of the data that the model should reproduce, such as the proportion of zeros, the maximum, the autocorrelation or a goodness-of-fit statistic.

Let TT be a test quantity and x‾rep\underline{x}^{\mathrm{rep}} be a replicated data set. The posterior predictive pp-value is the posterior probability that the test quantity of replicated data is at least as extreme as that of the observed data.

pB:=P(T(x‾rep,θ)≥T(x‾,θ)∣x‾)≈1S∑s=1S1{T(x‾rep(s),θ(s))≥T(x‾,θ(s))}p_B:=\mathbb{P}\left(T\left(\underline{x}^{\mathrm{rep}},\theta\right)\geq T\left(\underline{x},\theta\right)\mid\underline{x}\right)\approx\frac{1}{S}\sum_{s=1}^S\mathbf{1}_{\left\{T\left(\underline{x}^{\mathrm{rep}(s)},\theta^{(s)}\right)\geq T\left(\underline{x},\theta^{(s)}\right)\right\}}

The posterior predictive pp-value has the following properties:

  • values near 00 or 11 indicate that the model does not reproduce that feature of the data;
  • it is not a frequentist pp-value and is not uniformly distributed under the model, since the data are used both to fit the model and to assess it, which makes it conservative;
  • it is a measure of discrepancy rather than a formal test, and graphical comparisons of the observed data with replicated data sets are often more informative than a single number.

A prior predictive check is the method that draws replicated data from the prior predictive distribution and assesses whether the prior and likelihood together produce plausible data before any are observed. Prior predictive checks are how prior choices are calibrated.

A sensitivity analysis is the method that repeats the analysis under alternative priors and model specifications to assess how much the conclusions depend on choices that the data cannot settle.