Bayesian statistics is the branch of Statistics that represents uncertainty about unknown quantities as probability distributions and updates those distributions as data arrive, using Bayes’ theorem. Instead of asking how likely the observed data would be under a fixed hypothesis, it asks how plausible each possible parameter value is, given the data and prior knowledge.
In data analysis, the Bayesian approach produces a posterior distribution rather than a single estimate and a p-value. That distribution supports direct statements such as “there is a 92% probability that variant B converts better than variant A”, which many decision makers find more natural than the frequentist language of hypothesis testing and confidence intervals.
How Bayes’ theorem updates beliefs
The core mechanism is a single rule: the posterior is proportional to the likelihood multiplied by the prior. Written formally, p(θ | data) = p(data | θ) × p(θ) / p(data), where θ is the unknown parameter. The denominator, called the marginal likelihood or evidence, normalizes the result so that probabilities sum to one.
Each component has a distinct role. The prior encodes what is known before seeing the current data, the likelihood describes how probable the observed data are for each value of θ, and the posterior combines both. Updating is sequential and coherent: today’s posterior can serve as tomorrow’s prior, and processing data in batches gives the same answer as processing it all at once.
| Component | Notation | Meaning | Source |
|---|---|---|---|
| Prior | p(θ) | Belief about θ before the data | Domain knowledge, earlier studies |
| Likelihood | p(data | θ) | Probability of the data for each θ | Statistical model of the process |
| Posterior | p(θ | data) | Updated belief about θ | Computed from prior and likelihood |
| Evidence | p(data) | Normalizing constant | Integral over all θ |
| Posterior predictive | p(new data | data) | Forecast of future observations | Posterior averaged over θ |
When the prior and likelihood belong to matching families, called conjugate pairs, the posterior has a closed form. A Beta prior with binomial data, for instance, yields a Beta posterior whose parameters simply add the observed successes and failures.
Priors, posteriors and credible intervals
Choosing the prior is the most debated step in Bayesian practice. Priors range from strongly informative to deliberately vague, and the right choice depends on how much trustworthy knowledge exists and how much data will be collected. With large samples, the likelihood dominates and reasonable priors lead to nearly identical posteriors.
| Prior type | Example | When it fits |
|---|---|---|
| Informative | Normal centered on a past estimate | Reliable earlier evidence exists |
| Weakly informative | Normal(0, 2.5) on a log-odds scale | Default for regularizing most models |
| Noninformative or flat | Uniform over a wide range | Sensitivity checks, simple problems |
| Jeffreys | Beta(0.5, 0.5) for a proportion | Invariance under reparameterization |
| Hierarchical | Group means drawn from a shared distribution | Many related groups or units |
The posterior is summarized with a point estimate, such as the posterior mean or median, and an interval. A 95% credible interval contains the parameter with 95% probability given the model and data, which is the interpretation people often wrongly attach to a frequentist confidence interval. The highest density interval is the narrowest such interval and is preferred for skewed posteriors.
Bayesian and frequentist statistics compared
The two schools differ mainly in what probability describes. Frequentist methods treat parameters as fixed and probability as the long-run frequency of data under repeated sampling; Bayesian methods treat parameters as uncertain and probability as a degree of belief. Both are mathematically rigorous, and with ample data and weak priors they often give numerically similar answers.
| Aspect | Bayesian | Frequentist |
|---|---|---|
| Parameters | Random variables with distributions | Fixed but unknown constants |
| Main output | Posterior distribution | Point estimate, standard error, p-value |
| Interval meaning | Probability the parameter lies inside | Coverage over repeated samples |
| Prior knowledge | Explicitly included | Not formally included |
| Stopping rules | Posterior unaffected by optional stopping | Peeking inflates false positives |
| Computation | Often heavy, simulation based | Usually closed form or fast |
In practice, many analysts use both. Regularization methods such as ridge regression have direct Bayesian interpretations, and Bayesian versions of linear regression are common when uncertainty about coefficients must be propagated into forecasts.
Computing the posterior in practice
For most realistic models, the evidence integral has no closed-form solution, so posteriors are approximated numerically. Markov chain Monte Carlo methods draw correlated samples whose distribution converges to the posterior; modern samplers such as Hamiltonian Monte Carlo and its adaptive No-U-Turn variant handle hundreds or thousands of parameters efficiently.
Faster alternatives trade accuracy for speed. Variational inference fits a simpler distribution to the posterior by optimization and scales to very large datasets, while the Laplace approximation uses a normal distribution around the posterior mode. Probabilistic programming languages such as Stan, PyMC and NumPyro let analysts specify models declaratively and run these algorithms automatically.
- Check convergence with diagnostics such as R-hat close to 1.00 and adequate effective sample size.
- Run prior predictive checks to confirm that priors generate plausible data.
- Run posterior predictive checks to compare simulated and observed data.
- Test prior sensitivity by refitting with alternative reasonable priors.
Limitations and common misconceptions
Bayesian statistics is not automatically more objective or more accurate. A poorly chosen prior can bias results, especially with small samples, and a misspecified likelihood produces a confidently wrong posterior just as it would produce a misleading frequentist estimate. Model checking remains essential regardless of the framework.
| Mistake | Consequence | Remedy |
|---|---|---|
| Using flat priors by habit | Unstable or implausible estimates | Weakly informative priors |
| Ignoring sampler warnings | Biased posterior summaries | Reparameterize, inspect divergences |
| Choosing priors after seeing data | Overconfident conclusions | Preregister priors where stakes are high |
| Reporting only the posterior mean | Uncertainty is hidden | Report credible intervals and plots |
| Overreading Bayes factors | Strong claims from prior-sensitive ratios | Check sensitivity, prefer estimation |
Computation is a practical constraint. Complex hierarchical models can take minutes to hours to fit, and communicating priors to nontechnical stakeholders requires care. Another misconception is that Bayesian methods remove the problem of sampling bias; no prior can correct data that were collected from the wrong population.
In plain words
Bayesian statistics is a way of learning from evidence step by step. It starts with a reasonable guess about something unknown, then adjusts that guess each time new data come in. Strong evidence moves the belief considerably, while weak evidence moves it only a little.
A doctor reasons this way when a common illness is suspected before tests return. The test result then raises or lowers that suspicion. The key takeaway is that conclusions come with an honest range of uncertainty, not just a single number.
A real-world example
A subscription software company tests a new checkout page. Previous experiments suggest conversion rates near 4%, so the analyst sets a Beta(8, 192) prior, equivalent to about 200 earlier observations centered on 4%. After two weeks, the old page records 412 conversions from 10,000 visitors and the new page records 468 from 10,000 visitors.
The Beta-binomial update gives posterior means of about 4.1% and 4.7%. Drawing 100,000 samples from both posteriors shows that the new page is better in roughly 97% of simulations, with an expected lift of about 0.55 percentage points. The product manager can read that statement directly and weigh it against implementation cost. Because Bayesian updating is not distorted by checking results daily, the team monitors the test continuously and ships the new page with a clearly quantified risk instead of waiting for a fixed sample size.