Past exam of the mathematics course of the University of Cambridge 2015 iii Paper 33 4 b Solution Created 2026-10-03 Updated 2026-10-06
The generalized cross-validation curve reaches its minimum at among the supplied grid values. This balances improved conditioning against shrinkage bias using an estimate of prediction error, rather than choosing the penalty with the smallest training residual sum of squares. Nearby values have similar errors, so the plot does not establish a highly precise optimal penalty.
Reading the PDF table at gives the fitted regression intercept and slopes:These table entries are necessary because the TeX stores the table only inside a figure. The ridge regression slopes are shrunk relative to the zero-penalty fit; their small nonzero values do not represent variable exclusion.
There is a minor source inconsistency: the prose says the predictors are centered, but the table's intercept varies with . With exactly centered predictor columns and an unpenalized intercept it would remain . The numbers above faithfully report the printed table, while part (a) gives the centered formula and the general uncentered conversion. The table therefore reflects a different or incompletely described preprocessing convention.
Past exam of the mathematics course of the University of Cambridge 2016 ib Paper 4 19H a Solution Created 2026-09-24 Updated 2026-10-06
Let . Under the usual nondegenerate regression assumption , maximizing the normal likelihood is equivalent to minimizing the residual sum of squares. The normal equations and give the maximum-likelihood estimatorsWrite and . Then , , and the residual is . Independence of the errors givesFor each ,Thus the three requested variables are pairwise uncorrelated.
They are linear functions of the jointly normal error vector. More strongly, the whole vector has a multivariate normal distribution, and its block covariances show that , and the residual vector are independent, by uncorrelated jointly normal variables are independent. Independence is preserved when applying a measurable function to the residual block. HenceThe residual projection is , of rank , so additionally . This is the orthogonal projection of a Gaussian vector interpretation of the same result. The printed design conditions alone allow ; then the fit is exact, the positive-variance likelihood has no finite maximizer, and the residual test in part (b) is undefined. The standard testing question therefore needs .
Past exam of the mathematics course of the University of Cambridge 2016 iii Paper 206 1 a Solution Created 2026-10-03 Updated 2026-10-06
Use a common intercept and laboratory-specific slopes in the normal linear model. With denoting days and the indicator variables for laboratories B and C, the design matrix has row , andThe interaction terms change slopes, without introducing laboratory-specific intercepts. Thus the estimated daily growth rates arein millimetres per day, with fitted common intercept mm. The residual degrees of freedom are . The usual unbiased error variance estimate is the square of the residual standard error:The small difference from arises from rounding the standard error to two decimal places; the latter uses the more precise residual sum of squares supplied later. A maximum-likelihood estimate would instead divide that residual sum of squares by .
Past exam of the mathematics course of the University of Cambridge 2017 ib Paper 3 20H b Solution Created 2026-09-24 Updated 2026-10-05
Write the one-column design as and . Maximizing the normal linear model likelihood first gives . Its minimized residual sum of squares is . For variance , the remaining log likelihood is plus a constant, whose maximum is atHere almost surely because and the true variance is positive. In the exceptional data case , the likelihood is unbounded as , so there is no positive-variance maximum.
Let , the orthogonal projection matrix onto the design column. Then and . These are orthogonal linear projections of an isotropic multivariate normal distribution, hence independent. An orthonormal coordinate system adapted to makes the residual squared length a sum of independent squared standard normals. Thus the joint distribution of least-squares and variance estimators is the product lawIn particular the maximum likelihood variance estimator is biased: ; the unbiased residual estimator uses denominator .
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 218 6 c Solution Created 2026-10-03 Updated 2026-10-05
The command performs a nested-model F-test for against , retaining the intercept and coefficient in both models. Write and for the residual sum of squares in the reduced and full fits. Under and the independent normal-error assumptions,By Cochran's theorem, the numerator and denominator are independent scaled chi-squares with one and degrees of freedom. Equivalently, for this single-coefficient restriction, , so its p-value equals that of the two-sided coefficient Student's t-test in model3.
Using the printed value gives and . The printed estimate and standard error instead giveThis discrepancy is present in the PDF and is too large to be explained by rounding at the shown precision; the underlying ANOVA output is omitted, so an exact unique statistic cannot be recovered. The univariate correlation and value imply , consistent with after rounding. With denominator degrees of freedom 97, the two versions give p-values approximately and , respectively. Either way the partial effect is not significant at 5%.
Past exam of the mathematics course of the University of Cambridge 2019 ib Paper 4 19H a Solution Created 2026-09-24 Updated 2026-09-29
Apart from terms independent of , the Gaussian log-likelihood isDifferentiating with respect to givesThe unique zero, and hence the maximum-likelihood estimate, isThe same value minimizes the residual sum of squares , since maximizing the Gaussian likelihood for fixed is equivalent to minimizing this sum. It is therefore also the least-squares estimator.
Past exam of the mathematics course of the University of Cambridge 2025 iii Paper 218 5 c Solution Created 2026-09-24 Updated 2026-09-25
The residual deviance of a Gaussian GLM is its residual sum of squares, . Thus the empirical training error for squared-error loss isIf training error is defined as the unnormalized total loss, its value is .
Pure error 2026-10-14
With repeated responses at an identical predictor configuration, pure error is their within-configuration variability. Its residual sum of squares can estimate measurement variance independently of a candidate regression mean function. Without replication, a fitted residual can combine pure error and lack of fit.
Residual estimate of Gaussian noise variance Created 2026-10-06 Updated 2026-10-14
For a correctly specified full-rank fixed-design Gaussian linear regression with , dividing the residual sum of squares by the residual degrees of freedom gives an unbiased estimator of the noise variance. The projection removes the whole deterministic mean, so the numerator's expectation is . A misspecified subset model need not have this property.
Residual sum of squares Created 2026-09-24 Updated 2026-10-14
The residual sum of squares measures how far the observed responses lie from their fitted values. If is the th regression residual, thenIt is the squared Euclidean norm of the regression residual vector. Squaring prevents positive and negative deviations from cancelling and gives large deviations more weight. In the constructed five-point example in linear regression, the regression residuals are , so the residual sum of squares is .
Ordinary least squares minimizes the residual sum of squares over the chosen linear regression family; ridge regression minimizes the residual sum of squares plus a penalty. Consequently the ridge regression fit can have a larger residual sum of squares than the ordinary least squares fit on exactly the same design matrix. For the one-predictor construction in ridge regression, the residual sum of squares rises from to when the penalty changes from to ; that increase is the cost of shrinking the fitted slope.
Dividing the residual sum of squares by gives the training error for squared-error loss, not an estimate based on fresh responses. Its units are squared response units, and it adds across observations, so raw totals need not be comparable across different response scales or sample sizes. Comparing fits to the same responses is useful, but choosing a ridge regression penalty by minimum training residual sum of squares favors the unpenalized fit. Assess prediction error using a validation set or cross-validation instead.[ref]
Model selection and validation 1: Cross-validation. slides 6–8 and 11–14: fresh-response error, training error and held-out scoring
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

