Assume and a current state with , . The unnormalized posterior density isThus the log-posterior, up to an additive constant, is the log-likelihood plus the beta distribution and exponential distribution log prior densities. The exponential distribution rate is , since is its mean. [ref]
https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Beta.html. Official R documentation: dbeta arguments and logarithmic density output
[ref]https://stat.ethz.ch/R-manual/R-devel/library/stats/html/Exponential.html. Official R documentation: dexp rate parameter and mean equal to inverse rate
Choose a symmetric joint random-walk Metropolis algorithm proposal: and , for independent standard normal distribution draws. Its scale depends only on fixed hyperparameters, so forward and reverse proposal probability density functions agree. Reject immediately outside ; otherwise accept with Metropolis–Hastings acceptance probabilityThe following function makes exactly one proposal, with rejection retaining both old parameters:
MHstep <- function(x, p, beta, a, b, mu) {
p_new <- rnorm(1, mean = p, sd = 0.1)
beta_new <- rnorm(1, mean = beta, sd = mu / 2)
if (p_new <= 0 || p_new >= 1 || beta_new <= 0)
return(list(p = p, theta = beta))
logpost <- function(pp, bb) {
ll_f(pp, bb, x) + dbeta(pp, a, b, log = TRUE) +
dexp(bb, rate = 1 / mu, log = TRUE)
}
logA <- logpost(p_new, beta_new) - logpost(p, beta)
if (log(runif(1)) <= min(0, logA)) {
p <- p_new
beta <- beta_new
}
list(p = p, theta = beta)
}The returned field
theta contains the updated value of beta. The original PDF really asks for p and theta, although no parameter is defined in this question. This choice preserves its literal interface while making the intended second parameter explicit. A caller therefore advances with state <- MHstep(x, p, beta, a, b, mu), p <- state$p, and beta <- state$theta.The proposal is an unrestricted symmetric normal distribution followed by rejection outside the support. Repeatedly drawing until a valid proposal appears would instead truncate and renormalize the proposal, requiring a proposal-density correction. The code uses immediate rejection and needs no such correction. The displayed scales are valid fixed choices; practical efficiency can be improved using a separate tuning phase.
Let . The Bernoulli distribution likelihood function is . Multiplication by the beta distribution prior density and Bayes' theorem giveRecognizing the normalized beta distribution,This is Beta-binomial conjugacy; the same update applies whether the data are recorded as the individual Bernoulli trials or their success count.
The Jeffreys prior is invariant under smooth one-to-one reparameterization. This means that applying the rule directly in a new parameter gives the same prior distribution as first constructing the rule for and then transforming its prior density by the change-of-variable formula.
More explicitly, for a differentiable invertible change of parameter with nonzero derivative,Thus and represent the same measure, up to the normalization constant. Invariance concerns the measure: the numerical values of the prior densities need not be equal in the two coordinates. The same change of variables then makes the posterior distributions agree. This is the reparameterization invariance of Jeffreys prior.
For a scalar statistical parameter in a regular model with probability mass function , define the one-observation expected Fisher information byThe Jeffreys prior is the prior density specified, up to a factor independent of , byFor independent observations the Fisher information is , so the factor does not change this prior distribution. If is finite, divide by this integral to normalize; otherwise the rule defines an improper prior.
Let and . For the observed positive data, the uniform distribution likelihood function isMultiplying by the Pareto distribution prior density gives the posterior density kernel . Sincethe normalized posterior distribution isThis is uniform-Pareto conjugacy. The posterior density is strictly decreasing over its support, so the highest posterior density interval starts at , where the admissible density is largest in the limiting sense. Its upper endpoint satisfiesHence a 95% highest posterior density interval isInclusion of endpoints does not change its posterior probability. Every point inside has higher posterior density than every admissible point to its right, and points below have density zero. This is the Pareto highest density interval; equal endpoint densities are unnecessary because one endpoint is the support boundary.
Set and . Conditional independence of the binomial distribution observations gives the likelihood functionThe prior distribution is the beta distribution with parameters . By Bayes' theorem, multiplying the prior density by the likelihood function gives a posterior density proportional toRecognizing and normalizing this beta distribution givesfor . This is Beta-binomial conjugacy; the original binomial coefficients cancel in the normalization because they are independent of .
Let , , and . The independent observations in the normal linear model giveThe centered design condition removes the term:The stated prior density factors into independent normal distributions for the regression intercept and regression coefficient . Multiplication by the likelihood function therefore leaves separate quadratic expressions in the two coefficients. Define the positive posterior variancesand the posterior meansBy completing the square, the joint posterior density isEquivalently,This is Gaussian conjugacy for a normal linear model. Each posterior precision parameter is the sum of its data and prior precision parameters. The formulas remain valid when : all are then zero, so the posterior distribution of equals its prior distribution.
Past exam of the systems biology course of the University of Cambridge 2024 Paper 3 2 c Solution 2026-10-20
The exponential distribution prior has rate and support , so its prior density is . By Bayes' theorem,where is a normalizing constant independent of .
Completing the square gives a useful exact reference for the numerical sampling. PutThen this normal mean posterior with an exponential prior is a normal distribution with location and variance , truncated below at zero. With the standard normal distribution density and its cumulative distribution function,The exponential rate is , not three; the prior mean is three. The support restriction must be retained in both the formula and the sampler.
Let a fixed policy intensity have prior density on , and let annual claim counts be conditionally independent with Poisson distribution mean . The expected process variance is and the variance of hypothetical means is , so the Bühlmann credibility factor is . A total count gives the displayed credibility premium. By contrast, the Bayesian posterior density is proportional to on . Its mean is the ratio . For , that Bayesian credibility estimate is , whereas the affine estimate is .
Poisson-gamma conjugacy Created 2026-09-24 Updated 2026-10-25
For conditionally independent Poisson observations of mean and a gamma distribution prior of shape and rate , the likelihood function contributes . Multiplying by the prior density gives a posterior distribution with shape and rate . The single-observation update is shape and rate .
The posterior mean is the convex combinationThus the prior mean and the sample maximum-likelihood estimate bracket it. Integrating the next conditional Poisson distribution against this posterior distribution gives the Poisson-gamma mixture, a negative binomial distribution; its spread includes uncertainty in as well as the conditional count variation.
Prior density Created 2026-10-07 Updated 2026-10-14
A prior density is the probability density function of a continuous prior distribution with respect to a specified reference measure. A proper prior density is nonnegative and integrates to one. Prior-density factors enter Bayesian posterior and RJ-MCMC acceptance formulas along with the likelihood and model prior probabilities.
Prior probability Created 2026-09-24 Updated 2026-10-14
Prior probability describes uncertainty before the current observations are incorporated. For a statistical parameter , a prior distribution assigns probabilities to its possible ranges, conditional on background information and a statistical model. A continuous prior density specifies these probabilities through integration:Here the probability density function is relative to Lebesgue measure ; a discrete prior distribution instead uses a probability mass function and sums. Density at one point is not the probability of that point. A nonnegative kernel with infinite total mass is an improper prior, whose use requires a separate check of posterior propriety.
For the coin model in Bayesian statistics, the beta distribution has prior density on . Its mean is and its variance is . It favors moderate heads probabilities without ruling out values near zero or one. For example,The prior curve in Bayesian posterior makes this preference visible; moment matching for a beta prior explains how to choose a beta distribution from a desired mean and variance.
A prior distribution lets earlier evidence or elicited knowledge contribute to statistical inference when the current sample size is limited. It also exposes assumptions that can be checked by prior elicitation and a prior predictive check. Before the same eight heads and two tails, a uniform prior would give posterior mean , compared with under : the observations do not uniquely determine a Bayesian posterior. Even a uniform prior makes a choice of parameter coordinates; its child article explains why changing coordinates can destroy uniformity.
For a regular scalar model, let be a smooth invertible change of statistical parameter with nonzero derivative. The chain rule makes the score function in the new coordinate equal to the old score function times . Therefore the expected Fisher information transforms as . Taking its square root gives exactly the absolute change-of-variable factor required for a prior density.
Consequently, computing the Jeffreys prior directly in either coordinate produces the same measure after transformation. Its density is not numerically constant across coordinates, nor must either density be uniform. When the prior distribution is proper, compatible normalization gives identical prior probabilities for corresponding sets; the resulting posterior distributions also transform consistently. For an improper prior the equality concerns measure kernels up to a constant, and posterior propriety still needs checking.
Scalar static-state Kalman update Created 2026-10-03 Updated 2026-10-14
Suppose the predicted state has normal distribution and the new observation is , where the measurement noise is independent of the state and previous observations. Gaussian conditional expectation givesThe coefficient is the scalar Kalman gain. The posterior mean is a weighted mean of the predicted state and the new observation, with the more precise quantity receiving more weight. For , the same equations can be expressed in precision parametersThe two precision parameters add because the measurement noise is independent of the state and past observations. Completing the square in the product of the prior density and the likelihood function gives this form directly. This is a Gaussian conditional expectation for a fixed unknown state; a moving state additionally requires a Kalman prediction step.
Uniform-alternative binomial Bayes factor Created 2026-10-14 Updated 2026-10-25
For a binomial distribution count, compare a point null with the uniform alternative prior distribution on . The alternative Bayesian model evidence isso the exact Bayes factor favouring the point null is . With standardized deviation , the local normal distribution approximation is . At fixed the frequentist p-value remains approximately constant, while the factor grows like . This demonstrates the prior-width mechanism behind the Jeffreys-Lindley paradox for a Gaussian point null in a discrete sampling model.
For a separate original example, change the point null to and take to have a uniform prior , fixed before the ten Bernoulli trials. Here is drawn once under and shared by all ten trials: they are independent conditional on . For one particular ordered sequence with eight heads and two tails, the Euler beta function givesThus the Bayes factor for the uniform alternative against the point null isThe binomial distribution count formulation gives and . Their ratio is again ; these count masses must not be combined with the ordered-sequence masses above. The general formula at the start of this article puts the point null in the numerator, so it equals here.
In contrast, maximum likelihood estimation gives : differentiating the log-likelihood yields , and the endpoints have zero likelihood. Its peak-to-null likelihood ratio isThis peak is chosen after seeing the data, so it is not the Bayes factor of the prespecified . The Bayesian model evidence for averages over its entire uniform prior; it is smaller than the peak. It is also smaller than . Against the same null, a point alternative fixed at would give a Bayes factor about , greater than . An integrated alternative need not outperform a point alternative.
For a general proper beta distribution prior distribution with , the same ordered-sequence marginal likelihood is . This follows by substituting the normalized prior density into the integral, and shows exactly where the parameter prior distribution changes the Bayes factor. Holding the parameter prior distributions fixed while changing model prior odds leaves that Bayes factor unchanged.
Let a model have parameter prior density , observation probability and conditional binary-query probability after observation. Draw and an independent uniform random variable . Accept exactly when , then output whether . At fixed , the accepted true and false intervals have lengths and . Integrating against and dividing by the positive evidence proves equality of the joint posterior law of parameters and answer. This can replace many latent choices by one auxiliary coordinate. It preserves that joint law, not unreported latent traces. More generally the bounded factor must be a probability or first be divided by a valid common rejection envelope.
