Bayesian statistics

On this page 7

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.

ComponentNotationMeaningSource
Priorp(θ)Belief about θ before the dataDomain knowledge, earlier studies
Likelihoodp(data | θ)Probability of the data for each θStatistical model of the process
Posteriorp(θ | data)Updated belief about θComputed from prior and likelihood
Evidencep(data)Normalizing constantIntegral over all θ
Posterior predictivep(new data | data)Forecast of future observationsPosterior averaged over θ
Components of a Bayesian model

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 typeExampleWhen it fits
InformativeNormal centered on a past estimateReliable earlier evidence exists
Weakly informativeNormal(0, 2.5) on a log-odds scaleDefault for regularizing most models
Noninformative or flatUniform over a wide rangeSensitivity checks, simple problems
JeffreysBeta(0.5, 0.5) for a proportionInvariance under reparameterization
HierarchicalGroup means drawn from a shared distributionMany related groups or units
Types of prior distributions

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.

AspectBayesianFrequentist
ParametersRandom variables with distributionsFixed but unknown constants
Main outputPosterior distributionPoint estimate, standard error, p-value
Interval meaningProbability the parameter lies insideCoverage over repeated samples
Prior knowledgeExplicitly includedNot formally included
Stopping rulesPosterior unaffected by optional stoppingPeeking inflates false positives
ComputationOften heavy, simulation basedUsually closed form or fast
Bayesian versus frequentist approaches

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.

MistakeConsequenceRemedy
Using flat priors by habitUnstable or implausible estimatesWeakly informative priors
Ignoring sampler warningsBiased posterior summariesReparameterize, inspect divergences
Choosing priors after seeing dataOverconfident conclusionsPreregister priors where stakes are high
Reporting only the posterior meanUncertainty is hiddenReport credible intervals and plots
Overreading Bayes factorsStrong claims from prior-sensitive ratiosCheck sensitivity, prefer estimation
Frequent mistakes in Bayesian analysis

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.