Linear least squares 2026-10-13
Linear least squares minimizes over a vector . Its normal equations for linear least squares are ; geometrically is the orthogonal projection of onto the range of .
Log-linear exponential-decay fit Created 2026-10-18 Updated 2026-10-25
An exponential decay rate becomes a straight line in and , where is a fixed reference rate. Constant small fractional rate errors become approximately constant vertical errors by propagation of uncertainty. With independent Gaussian log-rate errors, linear least squares gives and .
The covariance matrix is obtained by applying the variance rules to these linear estimators:Transforming back gives , , and . If a candidate lifetime fixes the slope , the intercept must be refitted as . The profiled objective obeysThis follows by separating the centred slope residual from the unrestricted regression residual, whose inner product with the design columns is zero by the normal equations for linear least squares. Known supplied measurement errors are not rescaled by the observed reduced chi-squared. This log-error model is an approximation for proportional errors, not an exact replacement for every raw-count likelihood.
Orthogonal projection residual Created 2026-10-14 Updated 2026-10-31
An orthogonal projection residual is the difference between a vector and its orthogonal projection onto a linear subspace . It is orthogonal to every vector in , so for all . The Gram-Schmidt process uses such residuals to remove directions already represented by earlier basis vectors.
This is an optimality condition as well as a geometric description. No permitted change within can remove a further orthogonal component of . In the preceding dot product example, is perpendicular to the line spanned by .
The selected inner product matters. Keep and the same line, but use the weighted Euclidean inner product with . The projection coefficient and residual becomeNow , although . The orthogonality is with respect to , so it need not look perpendicular in the ordinary drawing. The squared weighted error isThe weighted optimum reduces the first-coordinate error from to , at the cost of increasing the magnitude of the second-coordinate error from to . The weights express which errors are more costly.
Changing the inner product changes the closest point: a circle and a weighted error ellipse touch the same permitted line at different points
. Details. In linear least squares, residual orthogonality to the column space is expressed by the normal equations for linear least squares. With a weighted Euclidean inner product, the corresponding real-matrix equation is . This makes the choice of error measurement part of the mathematical model, rather than merely a plotting convention.
Past exam of the mathematics course of the University of Cambridge 2006 iii Paper 39 1 Solution Created 2026-10-03 Updated 2026-10-14
Use a strictly positive bank account as numéraire, and write all prices and payoffs in discounted units. There are risky assets with deterministic initial price vector , terminal price vector , and gains . A self-financing portfolio with initial capital and constant risky holdings has discounted terminal wealth . The initial amount in the bank account is , so denotes total initial capital, not just the cash holding. Assume the usual absence of arbitrage, and hence existence of an equivalent martingale measure; wherever a general probability space is used below, explicitly assume that such a measure exists and makes the asset payoffs integrable.
The attainable claims are precisely the linear subspaceThe finite-dimensional subspace is closed, so every square-integrable contingent claim has a unique orthogonal projection onto . This is its optimal one-period least-squares hedging payoff. Holdings are unique after redundant assets have been removed. Putand suppose the remaining covariance matrix is invertible. Expanding the squared error givesFirst minimize over , then complete the square in . ThusThe residual satisfiesIndeed, every other squared error equals this minimum plusThis proves optimality, and also shows that zero error is equivalent to attainability of a European contingent claim. If initial capital is prescribed instead, the normal equations for linear least squares give ; one must not use the free-capital formula without this adjustment.
A dominated martingale measure is a probability measure such that . Its Radon-Nikodym derivative satisfies , , and . An equivalent martingale measure additionally requires almost surely. Every integrable attainable claim then has price , independent of which such measure is chosen. For an unattainable contingent claim, different dominated martingale measures can give different prices; least-squares approximation chooses a projection criterion rather than exact replication.
Write , where is the centered martingale part of the one-period gains. The minimal martingale measure in a one-period market changes the means of the traded gains to zero while preserving all square-integrable mean-zero directions orthogonal to . Its candidate density isDirect computation gives and . If and , then , as required. Conversely, an density with this preservation property is orthogonal to the orthogonal complement of , so it lies in that span. Its normalization and martingale constraints force exactly . Moreover,Every other square-integrable signed pricing density has the form , with orthogonal to and , hence to . Thereforeso the minimal density is also the minimum-norm one-period pricing weight. This coincidence concerns one period; it is not an unrestricted assertion about dynamic hedging models.
Positivity needs checking. If it defines an equivalent martingale measure; if merely , it defines a dominated martingale measure. Otherwise it defines only a signed martingale measure. For example, take and with physical probabilities . Then , , and in the third state. There is nonetheless an equivalent martingale measure assigning probabilities , whose mean gain is zero. Thus absence of arbitrage does not guarantee positivity of the least-squares density, and a least-squares initial cost need not be an arbitrage-free price for an unattainable payoff.
Finally prove completeness and uniqueness of dominated martingale measures. Suppose first that every bounded contingent claim is attainable. For any event , replicate . Under any dominated martingale measure, . Thus all such measures agree on every event. Existence follows from our no-arbitrage assumption, giving uniqueness.
Conversely, fix an equivalent martingale measure , and let . If the probability space admits disjoint events of positive probability, choose a basis of , including . The matrix with entries has a nonzero null vector . Consequently the bounded, nonzero random variablesatisfies and . For , defineThese are distinct equivalent martingale measures, because their densities are positive and their gain moments remain zero. Thus uniqueness rules out such a partition. A probability space with no disjoint positive-probability events consists, modulo null sets, of at most atoms: repeatedly split any non-atomic positive event to obtain a larger finite partition. On atoms the payoff space has dimension , while has dimension . Hence and is the whole payoff space. Every contingent claim is attainable. This provesHere completeness means all bounded claims, or all square-integrable claims in the formulation. The existence/no-arbitrage hypothesis matters: on a one-state space, cash and a stock with a sure positive discounted gain span every payoff, but no dominated martingale measure can make that gain have zero mean.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 49 1 Solution Created 2026-10-03 Updated 2026-10-14
A cubic spline belongs to and is a polynomial of degree at most three on each interval separated by the spline knots. A natural cubic spline is additionally an affine function on the exterior intervals and . On this is equivalent to the endpoint conditions ; these conditions remain part of the definition when an outer knot coincides with or .
Let be the natural cubic spline interpolant of the prescribed values, and let be any other interpolating function. Set , so . On the interval , integration by parts twice givesbecause the fourth derivative of each cubic piece is zero. The second boundary term is zero because vanishes at the spline knots. After summing the first terms, the interior contributions cancel by continuity of and , and the two remaining terms vanish by the natural endpoint conditions. On the exterior intervals . Thus , and the second derivative roughness penalty satisfiesIf equality holds, the continuous nonnegative function has zero integral, so everywhere. Hence is an affine function, and its zeros at two distinct spline knots force . This proves the minimum roughness property of the natural cubic spline interpolant and its equality case: the unique minimum-roughness interpolant is .
For the fixed-design nonparametric regression fit, use the penalized least squares criterionLet be the natural cubic spline interpolant with value vector . Replacing by for leaves the residual sum unchanged and reduces the second derivative roughness penalty, strictly unless . It therefore remains to minimize the finite-dimensional quadratic formThe supplied spline roughness penalty matrix is positive semidefinite. For every nonzero vector ,Consequently is a positive-definite matrix, and is strictly convex. Its normal equations for linear least squares have the unique solutionThe preceding strict reduction also proves uniqueness over the whole class , not just over the natural cubic splines. This is the cubic smoothing spline. If the residual criterion is divided by instead, the corresponding formula is , reflecting a change in the numerical convention for the smoothing parameter.
The independence and specified error mean and variance are not needed for existence or uniqueness of this minimizer. They do imply, with smoothing matrix and , that and . The null space of consists of sampled affine functions: these have zero roughness, and conversely zero roughness forces their natural cubic spline interpolant to be an affine function. Thus these functions are reproduced without bias of an estimator, while other components are smoothed.
Past exam of the mathematics course of the University of Cambridge 2007 iii Paper 49 2 Solution Created 2026-10-03 Updated 2026-10-14
At a target , local polynomial regression fits a polynomial of degree at most by weighted least squares:Define the response vector , the design matrix by for , and the diagonal matrix by . The normal equations for linear least squares giveThis formula assumes the local polynomial Gram matrix is invertible. It is invertible whenever at least distinct sites have positive weights: a nonzero degree- polynomial cannot vanish at all of them. With fixed , a nonzero continuous regression kernel, and , this condition holds eventually at the target points considered here. Using weights instead gives exactly the same fit.
Use the usual unit-integral normalization . A regression kernel need not intrinsically have unit integral, but multiplying all weights by a positive constant leaves local polynomial regression unchanged. With unnormalized raw moments the interior coefficient below is ; the version written using alone requires this normalization. A zero regression kernel cannot define an estimator.
Write the local moment sums asThe local constant estimator is . Since the errors have zero mean, its bias of an estimator is the corresponding weighted average of . By the second-order Taylor expansion, uniformly for contributing sites with ,where . This uniform remainder follows from uniform continuity of on . Nonnegativity of the regression kernel therefore giveswhenever tends to a positive limit and .
For fixed interior , the moment approximations give , , and . The hypothesis makes , so the odd-moment contribution is negligible at second order. ThusThe symmetry of the regression kernel is what removes the first-order interior bias of an estimator.
At , the rescaled observation window is truncated to . Put and . Symmetry, nonnegativity, and unit mass give . The supplied moment approximations already imply the leading boundary bias of local constant regression:To retain the second-order term rigorously, we need slightly more precise control of the first moment. The rescaled grid has spacing . Each truncated function has bounded variation, because is continuously differentiable on its support. The Riemann sum error is bounded by this variation times the grid spacing: summing the oscillation bounds on the grid cells provesEndpoint cells, including the omitted site at zero, contribute the same error order. ConsequentlyBoth discretization errors are under . The preceding Taylor expansion therefore proves the second-order boundary expansion for local constant regression:Equivalently, expanding the derivatives about zero givesIn general the truncated first moment is nonzero, so the boundary bias of an estimator has order , although it can be smaller when or the omitted part of the regression kernel carries no mass.
For local linear regression, the polynomial reproduction property of local polynomial regression removes the constant and linear terms exactly. Let . Its effective kernel weights areso , , andAt either an interior or the specified boundary target, is asymptotic to a positive constant times . At the boundary that constant is , the mass squared times the variance of the continuous normalized truncated regression kernel. Moreover , as follows by bounding in the window. Thus the Taylor remainder still contributes , even though some effective kernel weights may be negative. In particular,At an interior point this coefficient reduces to by symmetry and normalization. Hence local linear regression has bias at both interior and boundary points; its linear reproduction removes the generic order- boundary term.
Past exam of the mathematics course of the University of Cambridge 2008 iii Paper 41 1 Solution Created 2026-10-03 Updated 2026-10-14
Write . In this normal linear model, the ordinary least squares criterion is . Differentiating with respect to gives the normal equations for linear least squares, . Full column rank of the design matrix makes invertible, and completing the square proves that the unique minimum isSince , its sampling distribution is the multivariate normal distributionLet be the hat matrix. It is symmetric and idempotent with rank , and . The regression residual vector is , soAn orthogonal projection of a Gaussian vector onto the residual space gives . The residual projection and fitted projection have zero cross-covariance, hence are independent because they are jointly normal. In particular, is an unbiased estimator of and is independent of . The maximum-likelihood estimator of instead divides by and is not unbiased.
For the null hypothesis , put . Under that null hypothesis, is standard normal and independent of . Therefore the Student t-test usesA two-sided level- test rejects when . The denominator is the estimated standard error of the regression coefficient.
The fitted linear regression includes an intercept and three covariates:Thus , and the residual degrees of freedom are . The fitted conditional mean isEach slope measures a conditional association with the response while the other two covariates are held fixed. Increasing wind speed by one mile per hour corresponds to a fitted decrease of in the concentration units used. Its standard error is , giving and a two-sided p-value of : evidence of a negative conditional association at the 5% level. The temperature slope is per degree Fahrenheit, with standard error , and p-value . The insolation slope is per langley per day, with standard error , and p-value . Neither of these last two conditional effects is significant at 5%; that does not establish that either true slope is zero. These are associations, not a demonstration of causal effects.
The intercept estimates the mean at zero values of all three covariates. Its value has a large standard error , giving and p-value . The zero-covariate combination may be outside the observed range, so this test may have little practical relevance. Every coefficient test uses a Student t-distribution with degrees of freedom.
The reported residual standard deviation measures unexplained variation in concentration units; the subsequent table gives , consistent with after rounding. The five-number residual summary describes the spread, from to , with median . An intercept forces the residual sum to zero, not the residual median. These five numbers alone cannot establish normal errors, constant variance or independence; residual-versus-fitted and quantile-quantile plots would be more informative, and successive days also warrant checking serial dependence. The coefficient of determination means that 65.33% of the sample response sum of squares about its mean is explained by this fit. Its adjusted version iswhich accounts for the number of estimated regression coefficients.
The stepwise selection by the Akaike information criterion searches between the intercept-only model and the specified model with all three main effects. For these Gaussian fits, the printed Akaike information criterion is, up to a constant common to the candidates,The full model has and AIC . Removing insolation increases the residual sum of squares by but decreases AIC to , so that removal is chosen. Removing temperature or wind instead would give AIC or and is worse. In the next step the candidate models include deletions and restoration of insolation. Keeping wind and temperature has the smallest AIC: removing temperature gives , restoring insolation gives , and removing wind gives . Hence the search stops, givingThe accompanying F-tests compare a larger model with a one-parameter reduction: , where is estimated from the larger model. For example, removing insolation gives , equal to the corresponding squared test statistic. Deletions from the second-stage model use in the denominator, whereas restoring insolation uses the full-model denominator. These tests describe the comparisons; they do not determine the AIC choice. In particular, temperature is retained despite its deletion-test p-value . AIC balances fit and complexity, and a stepwise optimum need not be a global optimum over a richer model class. Ordinary coefficient inference after choosing a model does not account for the selection itself.
For positive responses, the Box–Cox transformation is for , and . Its profile likelihood refits the linear regression and variance at each and includes the transformation Jacobian. The graph peaks at roughly –. The approximate 95% likelihood-ratio confidence interval contains values a little below zero through approximately one, using the cutoff . Thus a logarithmic transformation () and a square-root transformation () are plausible, while leaving the response on its original scale () is at or very near the upper confidence boundary. The broad profile supports considering a mild power transformation; it does not determine a sharply estimated power. The raster does not justify more precise endpoints or a decisive assertion about which side of the boundary lies.
Differentiate the ordinary least squares objective in a. Its normal equations for linear least squares areUsing and givesThe Hessian matrix of the objective in is , which is positive-definite, so this is its unique global minimum. For the observed estimates, replace by .
Compute the two sides of the normal equations for linear least squares and divide by :The first equation gives . Substitute this into the second and solve:These simple linear regression coefficients are unique provided the observed distances are not all equal, sinceThe condition alone does not guarantee this. If all , the design matrix has matrix rank one and the valid alternative is the familyIn this rank-deficient ordinary least squares case, the fitted predictions are uniquely but the two parameters cannot be separately determined.
The normal equations for linear least squares are . Under full column rank, . Since ,Here and , so the design matrix isIts columns are pairwise orthogonal and have squared lengths . Consequently , givingBoth estimators are linear functions of the Jointly Gaussian observation vector, so they are Jointly Gaussian. Zero covariance then implies independence. This final implication uses the normal error model, whereas the variance calculation itself needs only its second moments.
Minimizing the sum of squared residuals gives the normal equations for linear least squares, . Full column rank makes positive definite and invertible, so the unique minimizer isBecause and , one has andFor the alternative linear estimator the corresponding general formulas areNo normality assumption on the errors is needed for these claims.
The Gaussian linear model has log likelihood function, up to an additive constant,For each fixed positive , maximize this by minimizing the residual sum of squares. Differentiation gives the normal equationsThe full column rank of makes positive definite, hence invertible, soThe quadratic objective is strictly convex, which proves uniqueness. The joint maximum-likelihood estimate has the same coefficient estimate, except on the probability-zero event of an exactly zero residual when the positive-variance likelihood has no finite joint maximizer.
If is a minimizer, then for each the quadratichas a minimum at , so . Conversely, if this orthogonality holds, then for every the Pythagorean theorem in the inner product space givesThus the minimizers are exactly the orthogonal projections characterized byFor existence, write . The conditions form the normal equations , with Gram matrix and . For every nonzero coefficient vector ,Indeed a nonzero polynomial is nonzero on some open interval away from , where the weight is positive. Hence is a positive-definite matrix and is invertible, proving existence and uniqueness of . Uniqueness also follows from the preceding Pythagorean theorem identity. The zero of the weight at one point therefore causes no degeneracy on continuous functions or polynomials.
By part (c), the best polynomial of degree at most is odd, hence has the form . The orthogonal projection condition with givesThe residual is odd, so its weighted inner products with the even polynomials and vanish automatically. Thus all three normal equations hold and
Assume independent approximately Gaussian log-rate errors with known common standard deviation . The weighted least squares objective isSince all weights agree, the normal equations for linear least squares reduce toFor these data, , , and . Hence and .
The covariance matrix of the fitted slope and intercept follows from the inverse weighted design matrix product, or directly by writing both estimates as linear combinations of the independent :This givesThe parameter conversion and first-order propagation of uncertainty areConsequently,These are one-standard deviation errors. The estimates are correlated, since . The minimum is for four residual degrees of freedom. Because is supplied as a known measurement uncertainty, it should not be rescaled by the observed reduced . This is a log-linear exponential-decay fit.
Log-rate fit and the effect of imposing the alternative lifetime
. Original calculation from the exam measurements. The solid line fits both lifetime and normalization; the dashed line fixes and refits its normalization. The lower panel shows standardized log-rate residuals for the two fits. No error bar is assigned to proper time. Details.The normal equations for linear least squares areThe supplied QR decomposition gives full column rank because is invertible and . Hence, for every nonzero , . Thus is a symmetric positive-definite matrix and the displayed square system is nonsingular.
Reduced QR least-squares solution 2026-10-25
Let with and square invertible upper triangular . The normal equations for linear least squares reduce from to the system in the title. It is solved by back substitution. The geometric identity proves existence and uniqueness of the minimizer. For tall , is an orthogonal projection, not the identity on the entire observation space.

