Hierarchical Bayesian model Created 2026-10-05 Updated 2026-10-06
A hierarchical Bayesian model assigns distributions to local latent variables conditional on shared hyperparameters, then distributions to observations conditional on those latent variables. Its probabilistic graphical model records this conditional factorization, often using a plate for repeated observations. Integrating out latent variables gives the marginal likelihood of the hyperparameters. Priors described as flat on logarithms require a Jacobian determinant when densities are written in the original positive variables.
Maximum marginal likelihood estimator Created 2026-09-28 Updated 2026-10-07
A maximum marginal likelihood estimator chooses a hyperparameter by maximizing the data density obtained after integrating the model parameter against its prior distribution.
Partial pooling Created 2026-10-06 Updated 2026-10-14
Partial pooling estimates related local parameters jointly through shared hyperparameters. Each local Bayesian posterior balances its own likelihood function against a group prior distribution, with stronger shrinkage when its data are weak or the group variation is small. It lies between forcing all local parameters to be equal and estimating them independently. Random-effects meta-analysis is an important application.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 34 1 d Solution Created 2026-10-03 Updated 2026-10-07
Exchangeability means that the joint prior distribution is invariant under breed relabelling:for every permutation . The labels carry no prior information about maximum size. This is reasonable for comparable breeds before observing their measurements when no covariates or biological knowledge distinguish them.
Exchangeability does not imply independence. In a hierarchical Bayesian model, the parameters can be independent conditional on a shared hyperparameter but dependent after it is integrated out. Known systematic biological differences would call for a model of those differences, with exchangeability only for the remaining unexplained variation.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 34 1 f Solution Created 2026-10-03 Updated 2026-10-07
The Type II maximum likelihood estimator maximizes the Bayesian model evidence after integrating out the breed parameters:For positive sample sizes define . Up to an additive constant, the log-likelihood isDifferentiation gives the interior score equationAlso . If , the derivative decreases from infinity to , so a unique finite maximum exists. When all sample sizes equal , the equation becomes , givingFor no finite maximum exists. Plugging this hyperparameter estimate into the breed posterior distributions is an Empirical Bayes method.
Past exam of the mathematics course of the University of Cambridge 2013 iii Paper 34 1 g Solution Created 2026-10-03 Updated 2026-10-07
Here for every breed, so andThe Bayesian model evidence increases towards its supremum as . ThusFor a Pareto distribution, . The limiting empirical prior, and each corresponding posterior distribution, collapses onto .
The boundary result is coherent within the assumed model: the observations favour the smallest allowed upper limits. Nevertheless, reporting exact concentration on a prespecified bound is overconfident for finite data and ignores hyperparameter uncertainty. A proper hyperprior on , sensitivity analysis for , or a scientifically justified restriction on concentration avoids treating this limit as certain biological knowledge.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 35 4 d Solution Created 2026-10-03 Updated 2026-10-06
Calling the effects exchangeable random variables means that their joint prior distribution is unchanged by permuting study labels. In a hierarchical Bayesian model, conditional independent draws achieve this, and integrating shared hyperparameters induces dependence between studies. This permits partial pooling without asserting that all effects are identical.
The assumption is reasonable when the studies concern comparable treatments, populations, outcomes and follow-up, and no known study characteristic gives one effect a systematically different prior center. Relevant differences can instead enter a linear regression for study effects, after which the residual effects may be exchangeable. The numerical table counts deaths, so its event probabilities are mortality probabilities and indicates a lower mortality odds ratio. Interpreting those counts as beneficial responses would reverse the clinical meaning.
Past exam of the mathematics course of the University of Cambridge 2014 iii Paper 35 4 j Solution Created 2026-10-03 Updated 2026-10-06
Fit both the normal and Student t random-effect model with comparable proper prior distributions. Compare priors on the same spread measure: a normal distribution scale is a standard deviation, whereas the standard deviation is .
Use a posterior predictive check: draw study effects and binomial counts from each fitted hierarchy and compare replicated dispersion and extreme study contrasts with the observations. For predicting a new study, generate a new effect from the hierarchy rather than reusing an existing fitted effect. A Leave-one-out cross-validation with entire studies held out can compare integrated predictive probabilities for both arms of each omitted trial, averaging over hyperparameters and its unobserved study effect. Leave-one-study-out influence analysis also reveals whether the difference is driven by a single trial.
Prefer the heavier-tailed hierarchy if it improves the relevant predictive checks and held-out study predictions robustly to reasonable prior choices. The deviance information criterion can supplement the comparison, but its effective parameter count can depend on the latent-variable representation, and six studies give limited information about tail shape. A small numerical criterion difference alone is insufficient evidence.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 5 a Solution Created 2026-10-03 Updated 2026-10-06
The most plausible cause is strong dependence between the latent variables and covariance hyperparameters in their joint posterior distribution. In the usual conditionally independent Gaussian process classification model, put , , and . The probit regression likelihood is , while has a multivariate normal distribution with covariance matrix .
For distinct inputs and positive length scales, is positive definite. Its Gaussian probability density function contributesThe unit-rate exponential prior distribution on therefore givesIts scale is tightly tied to the current magnitude and shape of . Changing changes the eigenvectors and eigenvalues of its covariance matrix; a latent vector typical under the old covariance may be very atypical under a substantially different one. Holding fixed can thus restrict the range of a hyperparameter update, and holding the hyperparameters fixed restricts the next latent-function update. Even exact sampling of each full conditional distribution can move slowly along a narrow ridge of the joint posterior distribution.
Binary observations provide limited information about the absolute size of large correctly signed latent values. This can leave substantial scale uncertainty and strengthen the dependence. Long correlation lengths can also make the covariance matrix nearly singular and the latent coordinates highly dependent. These are plausible explanations for a large mixing time, not proofs that every data set causes slow convergence. A blocked Gibbs sampler removes dependence within its chosen blocks, but not dependence between them. Repeated identical inputs should be represented by one shared latent value; otherwise the nominal Gaussian matrix is singular and the displayed inverse formula must be replaced by a representation on its support.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 219 3 iii Solution Created 2026-10-03 Updated 2026-10-05
At the fitted hyperparameters, define , , and , with the matrices formed by pairwise kernel evaluations. Conditional independence of observation noise and future latent values givesThe residual has zero covariance with , so the joint normal law makes it independent of . This derives the conditional multivariate normal distribution and the Gaussian process regression posterior:The covariance is a Schur complement and is positive semidefinite. When nonsingular, its joint density is . Repeated phases can make it singular, in which case the displayed normal law is interpreted on its support.
This predicts the true latent light curve, so no future measurement variance is added. For noisy future observations, add their independent noise covariance to . Fixing the hyperparameters omits their estimation uncertainty, as requested; integrating over their posterior would add it. The periodic model extrapolates by phase, even though all prediction times follow the observed times.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 219 3 ii Solution Created 2026-10-03 Updated 2026-10-05
Use the periodic covariance functionIts positive semidefiniteness follows by pulling back a Gaussian kernel to the circle . A zero Gaussian process mean is an ensemble statement, whereas an exactly zero long-term average for every periodic light curve is stronger. To impose the latter literally, use a periodic Gaussian process with zero period average, replacing the kernel byHere is a modified Bessel function, and is the period average of the kernel. Subtracting each process's random period average produces this covariance, so it remains positive semidefinite. We use to enforce the stated mean subtraction; using gives the usual ensemble-zero-mean formulation and the same likelihood derivation.
Let and . The prior latent vector is and the independent Gaussian noise is , so with . The Gaussian-process marginal likelihood isPositive measurement variances make positive definite even if is singular. Maximize over all three hyperparameters, using a broad search in to find competing aliases, followed by joint optimization. Cholesky decomposition evaluates the likelihood without explicitly forming an inverse.
For a well-resolved interior maximum, let be the Observed Fisher information in the coordinates . Then . Equivalently, the profile-likelihood curvature in gives the same local nuisance-adjusted variance; keeping the other hyperparameters fixed would generally underestimate it. A profile interval with is a local approximation. If the period likelihood is multimodal or poorly constrained, fit the complete posterior with proper hyperparameter priors and report its modes and marginal credible intervals rather than a single Hessian error bar. The sampling pattern can create period aliases that a single local search misses.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 219 4 ii Solution Created 2026-10-03 Updated 2026-10-14
The probabilistic graphical model is the following Directed acyclic graph. The shared hyperparameters lie outside the plate; the plate repeats the local variables for . The observed colour is shaded, and the known error variance is a square.
Thus the parent sets are . Independent hyperparameter prior factors are represented by the three root nodes. With the printed improper priors this is a factorization diagram; it becomes a normalized generative model after proper priors are supplied.
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 216 1 b Solution 2026-09-28
After integrating out the multivariate normal distribution , the marginal distribution isUp to terms independent of , the log-likelihood isDifferentiating and setting the result to zero gives the maximum marginal likelihood estimatorThis is an Empirical Bayes method because the estimated hyperparameter is then inserted into the prior and posterior distributions.
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 216 2 b Solution Created 2026-09-28 Updated 2026-10-03
Multiplying the exponential family likelihood by its natural conjugate prior givesThus the posterior remains in the same family, with updated hyperparametersUnder quadratic loss, the Bayes estimator under squared error loss is the posterior mean. Differentiating the log-partition function that normalizes the conjugate prior gives
Ridge regression Created 2026-09-24 Updated 2026-10-14
Ridge regression fits a linear regression model while penalizing the size of its slope regression coefficients. For a fixed design matrix containing the slope predictors, observed responses , and an unpenalized regression intercept , the objective isHere is the all-ones vector, and is the squared Euclidean norm of the slopes alone. The first term is the residual sum of squares; the second implements regularization. No random-error assumption is needed to define this fit. The convention is a summed squared-error loss: writing the objective as gives the same fit when .[ref]
Modern regression 1: Ridge regression. slides 5 and 7: summed squared-error objective and unpenalized intercept
For an exact example, reuse the constructed pairs from linear regression. Their sample means are and , and the centered cross-products are and . ThusThe ordinary least squares line has slope and residual sum of squares . At , ridge regression has slope , regression intercept , and residual sum of squares ; at these become , , and . Every line passes through : the penalty reduces the slope while retaining the response sample mean.
The computational benefit is visible after predictor centering. Write for the design matrix with each column's sample mean subtracted, and . The unpenalized intercept in ridge regression gives , and the closed-form ridge regression estimator solvesFor any nonzero vector and , . This positive-definite matrix is therefore invertible even when lacks full column rank, including repeated columns or . The unique penalized slopes resolve the ambiguity of rank-deficient ordinary least squares; they do not supply evidence about slope directions absent from the data. This makes ridge regression useful for multicollinearity.[ref]
High-Dimensional Regression: Ridge. p. 1, equations (1)–(2): uniqueness for positive penalty regardless of design rank
Predictor centering and scaling serve different purposes. Centering handles the free regression intercept. Scaling determines what counts as a large slope: replacing by changes its coefficient to for the same predictions, changing its contribution to an unweighted penalty. A common convention forms standard scores using each nonconstant predictor's sample standard deviation , then penalizes slopes in those coordinates. Since , this is the weighted penalty in the original units. Constant columns have and must be removed before this scaling. Scaling is a modelling choice; equal penalties in original units and in standardized units define different fits.[ref]
Modern regression 1: Ridge regression. slide 7: center predictors, leave the intercept free and scale predictors to sample variance one
The singular value decomposition explains the shrinkage. If is the compact decomposition using the positive singular values , with columns of , thenThe principal-component shrinkage by ridge regression factors are between and : directions with small singular values are damped most. As , the fitted values approach ; the vanishing-penalty ridge limit recovers the ordinary least squares fitted vector as , even if the slope estimates at zero penalty are nonunique. The covariance and bias of a ridge regression estimator describes the resulting bias-variance tradeoff. A penalty can reduce variance of an estimator while introducing bias of an estimator; the unbounded directional risk of fixed ridge shrinkage rules out a uniform improvement for a fixed positive penalty over all possible signals.[ref]
For a second exact construction, choose a centered orthonormal set of three vectors,and set and . The squared singular values are and . At , the fitted coordinates along are , retaining and of their ordinary least squares values . At they become , retaining and . The unfittable component contributes to every residual sum of squares, giving total values , , and at penalties . These are constructed fits, not measured prediction results.
Exact synthetic ridge shrinkage retains the strong singular direction longer than the weak one
. Details. The penalty is a hyperparameter, so fitting slopes at a fixed value and selecting that value are separate tasks. Use a validation set or K-fold cross-validation to compare candidate penalties by held-out squared-error loss. In each split, compute predictor sample means and scales from that split's training data, apply the same transformation to its validation set, and refit the slopes; using held-out information in preprocessing introduces data leakage. Minimum training residual sum of squares cannot select useful shrinkage: ordinary least squares already attains the smallest possible value.[ref]
Model selection and validation 1: Cross-validation. slides 5–8 and 11–14: tuning for prediction, training error and refitting on each training fold
After model selection, refit on all training data with the selected penalty. A separate test set or nested cross-validation assesses the entire selection procedure; a low selected validation score alone is no performance guarantee.[ref]On Over-fitting in Model Selection and Subsequent Selection Bias in Performance Evaluation by Gavin C. Cawley and others. pp. 2079–2080: selection as part of fitting and nested assessment
Uniform-Pareto model evidence 2026-10-07
For positive observations and , the Bayesian model evidence follows by integrating the uniform distribution likelihood against a Pareto distribution prior. For independent groups with shared fixed hyperparameters, these evidences multiply. The resulting hyperparameter log likelihood is up to a constant.


