- Introduced by
- Thomas Bayes
- Year
- 1763
- Type
- Method
- Family
- probabilistic-inference
What does it do?
Bayesian inference is a statistical framework that uses Bayes' theorem to update beliefs about parameters or hypotheses as data accumulate.
Thomas Bayes' essay was published posthumously in 1763, but wider use of the approach came in the 20th century, and practical use for complex models depended on computational methods such as Markov chain Monte Carlo (MCMC). Unlike frequentist inference, which treats parameters as fixed unknowns, Bayesian analysis treats them as random quantities with probability distributions, which allows direct probability statements about parameters, formal use of prior information, and sequential updating.
The intuition behind the method
Bayesian inference combines a prior distribution for a parameter, which expresses belief before the data are observed, with the likelihood of the observed data, which expresses how well each parameter value explains those data. The result is a posterior distribution that describes belief after observing the data. Prior knowledge from earlier studies, expert opinion or theoretical reasoning is encoded in the prior and stated explicitly so that it can be examined. As data accumulate, the likelihood often comes to dominate the prior, so the posterior moves toward what the data support, though the speed of this shift depends on the amount of data and the strength of the prior. Bayes' theorem gives the relation P(parameter | data) = P(data | parameter) × P(parameter) / P(data). Because the posterior is a probability distribution over parameter values, it can answer questions such as the probability that a treatment effect exceeds a stated threshold, or the probability that one treatment is better than another. Frequentist p-values and confidence intervals answer different questions and need more careful interpretation for these purposes.
History
Thomas Bayes' essay, published posthumously in 1763, set out the basic idea of updating a belief about an uncertain parameter in light of evidence. Laplace is also credited with independently rediscovering and extending the theorem to inverse probability problems. Frequentist methods associated with Neyman and Pearson dominated much of statistical practice in the 20th century. In the 1990s, MCMC algorithms including Gibbs sampling and Metropolis-Hastings made Bayesian computation practical for complex models, and software such as Stan and JAGS later made it more widely accessible.
When to use it
Choose a Bayesian analysis when relevant prior information exists and can be justified, for example from earlier trials, a meta-analysis, expert judgment or regulatory guidance. It is also well suited when data arrive sequentially and decisions are updated as results come in, as in adaptive designs and interim analyses; when the model is hierarchical or latent-variable, as in multilevel or mixture models; and when the question is naturally a probability statement about a parameter. Shrinkage priors can stabilize estimates when samples are small or when there are many predictors relative to observations. Avoid a Bayesian analysis, or defer it, when no defensible prior can be stated and no sensitivity analysis is feasible, when the MCMC computation is not manageable, or when the analysis must follow a pre-specified frequentist procedure, as required by a regulator or a registered protocol.
Limitations and considerations
- Prior specification is subjective: different defensible priors can lead to different conclusions, so the sensitivity analysis is part of the method rather than an optional extra.
- Computational cost: MCMC sampling can be slow for large datasets or complex models, and checking convergence requires expertise.
- Default priors are not neutral: weakly informative defaults look objective but still embed assumptions about parameter scale and range, and results can be sensitive to that choice.
- Model comparison is demanding: Bayes factors need marginal likelihoods, which are computationally expensive to obtain for complex models and depend on the priors within each model.
- Reporting norms differ: some journals, reviewers and funders expect frequentist reporting, which can make Bayesian results harder to publish.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Prior information can be included formally: earlier trials, meta-analyses or expert opinion enter the analysis as explicit distributions, which can improve precision when the prior is relevant and well justified.
- Direct probability statements: the posterior gives statements such as P(effect > 0 | data) that answer the scientific question without the conditional reasoning required for a p-value.
- Sequential updating: the posterior can be recomputed after each batch of data, so interim results are available in a coherent form. Whether a stopping rule preserves frequentist error rates is a separate question; Bayesian stopping rules do not preserve them automatically, so operating characteristics must be evaluated separately when they matter.
- Flexible model structure: hierarchical structures, missing data and latent variables can be written into one model and estimated together, so multilevel models follow the same workflow as simpler ones.
- Shrinkage priors stabilize estimates: priors that pull coefficients toward zero regularize estimates when samples are small or when many variables are compared with few observations.
Applications
- Clinical trials: Bayesian designs can update decisions as interim data accumulate, and they are used in some adaptive trials, subject to regulatory acceptance.
- Precision medicine: hierarchical models can share information across subgroups while still giving posterior probabilities of benefit for each subgroup.
- Drug development: historical data can be used to form informative priors for a new study; the implications for regulatory acceptance and sample size must be checked for each application.
- High-dimensional genomics: sparse priors and Bayesian variable selection identify relevant signals among many candidate markers while regularizing the estimates.
- Epidemiological surveillance and ecological modeling: sequential updating and hierarchical models accommodate measurement error, missing data and spatial or temporal structure.
How it works
How it works
Specify the likelihood, which is the probability model for the data given the parameters, such as a normal model for continuous outcomes or a binomial model for binary outcomes. Then specify the prior distributions over the parameters, choosing among weakly informative priors (which let the data dominate), informative priors (which encode genuine knowledge from earlier studies), skeptical priors (which favor the null and require strong evidence to move beliefs) and empirical priors (estimated from pilot data). An empirical prior uses the pilot data twice, once to set the prior and again in the analysis, so this double use should be acknowledged and justified. Collect the data, then compute the posterior. Because conclusions depend on the priors, report a sensitivity analysis that refits the model with alternative priors.
Compute the posterior with Bayes' theorem in proportional form, P(θ|y) ∝ P(y|θ) × P(θ), where θ denotes the parameters and y the data. For simple models the posterior can be derived analytically, for example with a normal likelihood and a conjugate normal prior. For complex models, MCMC algorithms such as Gibbs sampling, Metropolis-Hastings and Hamiltonian Monte Carlo generate samples from the posterior, and summaries are computed from those samples. Report the posterior mean and the 95% credible interval, posterior probabilities of hypotheses such as P(effect > 0 | data), and, when comparing models, the Bayes factor BF₁₀ = P(data|model 1) / P(data|model 2). This entry uses BF > 3 as a working label for moderate evidence and BF > 10 for strong evidence. These are conventions rather than fixed rules, other scales exist, and the labels should not be read as established categories of evidence. Also report posterior predictive distributions for new observations and the MCMC diagnostics: the Gelman-Rubin statistic (Rhat, with a working value below 1.01 in this entry; this is a recommended threshold rather than a fixed rule, and cut-offs differ across sources), effective sample size and trace plots.
The posterior mean is the point estimate, and the credible interval gives the range of plausible parameter values. A 95% credible interval means there is a 95% posterior probability that the parameter lies in the interval. This differs from a frequentist confidence interval, whose 95% refers to the long-run coverage of the procedure over repeated studies. Posterior probabilities of hypotheses, such as P(effect > 0 | data), answer the scientific question directly, without the conditional logic of a p-value. A Bayes factor compares the evidence for two models on a continuous scale without requiring a significance threshold; its value reflects the priors placed on parameters within each model. Examine the shape of the posterior, since skewed or multimodal distributions can make the mean a poor summary. Finally, refit the model with alternative priors: if conclusions are stable across reasonable priors, the inference is more credible; if they change, the data alone do not settle the question.
Common pitfalls
- Unjustified priors: priors that are not stated and justified, or not tested by sensitivity analysis, make conclusions hard to assess. State priors before examining the data and test robustness to reasonable alternatives.
- Ignoring MCMC diagnostics: without checking Rhat, trace plots and effective sample size, posterior summaries may come from chains that have not converged, and the inference is then unreliable.
- Misreading posterior predictive checks: these compare replicated data with the observed data to assess model fit. Their probabilities are not frequentist p-values and should not be used as a significance criterion or as a model-selection rule.
- Analytic flexibility: choosing priors or models after seeing the results, deliberately or not, undermines the value of the posterior. Specify priors and candidate models before analysis, and report any changes made later.
- Overly strong priors: a strong prior can pull estimates toward the prior mean and mask real effects when it is misspecified. Skeptical priors need the same sensitivity checks as any other prior.
- Misinterpreting Bayes factors: BF = 3 does not mean there is a 75% probability that one model is correct. Converting a Bayes factor into a posterior model probability also requires prior probabilities for the models.
Frequently asked questions
What is a credible interval, and how does it differ from a confidence interval?
A Bayesian credible interval (typically 95%) is a range containing 95% of the posterior probability, so it can be read as: given the prior and the data, there is a 95% probability that the parameter lies in this interval. A frequentist 95% confidence interval is produced by a procedure that, across repeated studies, would contain the true parameter in 95% of cases. The two differ in meaning, even though they often give similar numbers for standard problems, which is a common source of confusion. Always state which interval is reported.
What is a prior, and how do I choose one?
A prior is the probability distribution over parameter values before the data are observed, reflecting prior knowledge or assumptions. Weakly informative priors contribute little information, while informative priors encode genuine knowledge, for example that a treatment effect is likely to be small based on previous trials. Skeptical priors strongly favor the null, so strong data evidence is needed to shift them. Choose priors by reviewing earlier literature, consulting domain experts and specifying a plausible range for each parameter, then test how the conclusions change under alternative priors. Report the priors explicitly and justify them. If reasonable priors lead to very different conclusions, the data are not yet sufficient to settle the question.
What is a Bayes factor, and how do I interpret it?
A Bayes factor compares the evidence for two models: BF₁₀ = P(data | model 1) / P(data | model 2). Values above 1 favor model 1; when model 2 is a null model, values below 1 are evidence for the null. This entry uses BF > 3 as a working label for moderate evidence and BF > 10 for strong evidence for model 1. These are conventions rather than fixed rules, other scales exist, and the labels should not be treated as established categories of evidence. Unlike a p-value, a Bayes factor does not need a predefined significance threshold. Its value depends on the priors placed on parameters within each model, so those priors should be reported and tested. Turning Bayes factors into posterior probabilities for the models also requires prior probabilities for the models themselves. Use Bayes factors for model comparison when both models have a clear substantive motivation.
Does Bayesian analysis avoid the multiple comparisons problem?
Only partly. Priors and hierarchical shrinkage reduce the tendency to overstate differences when many comparisons are made, but they do not remove multiplicity problems. Bonferroni-type adjustments are not built into the posterior by default, so a decision threshold on a posterior probability, such as declaring an effect when P(effect > 0 | data) exceeds a chosen value, needs explicit justification when many comparisons are examined. If many models are fitted and the best one is selected using criteria such as DIC or WAIC, selection bias can occur, similar to multiple testing in the frequentist setting. Where possible, specify models on theoretical grounds before examining the data. For exploratory work, assess predictive performance on held-out data, for example by cross-validation. Bayesian model averaging, which weights predictions from several models by their posterior probabilities, represents model uncertainty without selecting a single model.
Related methods
Sources
Bayes, T. (1763). An essay towards solving a problem in the doctrine of chances. Philosophical Transactions of the Royal Society, 53, 370–418.
Open publication referenceGelman, A., Carlin, J. B., Stern, H. S., & Rubin, D. B. (2013). Bayesian Data Analysis (3rd ed.). CRC Press.
Open DOI referenceKruschke, J. K. (2015). Doing Bayesian Data Analysis: A Tutorial with R, JAGS, and Stan (2nd ed.). Academic Press.
Open DOI reference