For a full-rank ordinary least squares design matrix, the hat matrix and residual projection satisfy . Hence fitted values and regression residuals are perpendicular as observed vectors. Under isotropic errors their cross-covariance matrix is zero, and under a normal linear model the two vectors are independent.
The regression residual vector is , where is the hat matrix. Both and are symmetric idempotent matrices, and . Therefore and the linear image of a multivariate normal vector gives
This multivariate normal distribution is singular, with rank : fitted-residual orthogonality forces . Specifically, and for distinct observations. Thus regression residuals are generally neither independent nor identically distributed, even though the model errors are. Also and is independent of , which justifies the standard errors and exact Student t-tests below.
Full column matrix rank makes a positive-definite matrix, and its matrix inverse is symmetric. Thus the hat matrix satisfies
Also and the image of is contained in the column space of . These identities show that is the orthogonal projection matrix onto the column space of .
For the normal linear model, the log-likelihood is
The full column rank of the design matrix makes invertible. Differentiating in gives the normal equations . With the minimized residual sum of squares substituted, differentiation in gives
These are the maximum-likelihood estimators almost surely; almost surely when and . The linear transformation of the multivariate normal distribution yields
Define the hat matrix . The fitted values are , the regression residuals are , and . The orthogonal projection has rank and annihilates . By Cochran's theorem,
Consequently , with bias . The unbiased estimator is
Its square root, the reported residual standard error, estimates ; the assertion of unbiasedness applies to the variance, not generally to its square root.
For the paper-strength analysis, let be the measured percentage and . Both normal linear models use independent errors of common variance . Their mean functions are for lm1, and for lm2, with separately fitted coefficients. The reported residual standard errors are and , respectively.
For lm1, the estimated conditional expectation at a new percentage is
The original data mean must be used for centering the new percentage; its numerical value is not supplied in the excerpt. Because , the two columns of this design matrix are orthogonal, and . Hence the coefficient standard errors in the output give
This estimates uncertainty in the mean. Predicting an individual future batch would additionally require the new-error variance, estimated by .
To compare the nested normal linear models, test against within the quadratic model. The Student t-test statistic is
Its two-sided p-value is . Equivalently is a partial F-test statistic with null distribution . Reject the linear restriction and prefer lm2 at the 5% level. Its residual spread is much smaller; the increase in the coefficient of determination from to supports the same conclusion, although the test is the relevant complexity-adjusted comparison.
For regression diagnostics, inspect regression residuals against fitted means and hardwood percentage for omitted curvature, a scale-location plot for nonconstant variance, and a quantile-quantile plot against the normal distribution for departures from the error assumption. Check unusual observations using regression leverage and Cook's distance, and examine residuals in collection or batch order if dependence is plausible. Independence and a common variance require substantive justification as well as these plots; a small p-value for a polynomial term does not itself check the error model.
The ordinary least squares objective has gradient . The normal equation therefore gives
The Gram matrix is a positive-definite matrix because has full column rank. More explicitly, for any ,
since . This proves that the displayed solution is the unique global minimum.
The fitted values are , where the hat matrix is
The inverse of the symmetric matrix is symmetric, so . Multiplication gives . Thus is the orthogonal projection onto the column space of the design matrix.
The regression residual vector is with . Consequently , , and the residual sum of squares is
By fitted-residual orthogonality, . Using , the cross-covariance matrix is
Both vectors are jointly normal, so they are also independent by independence of uncorrelated jointly normal variables. The zero covariance calculation itself only needs the common error variance and lack of error correlations.
For the first wind fit, let be wind velocity and electrical output. The simple linear regression is , with independent . It has two fitted mean parameters and residual degrees of freedom. The missing analysis of variance entries are therefore velocity degrees of freedom , velocity mean square , and residual degrees of freedom . The residual mean square is , and , consistent with the printed value after rounding.
Because the model includes a regression intercept, the coefficient of determination is the explained sum of squares divided by the total centered sum of squares:
A large coefficient of determination does not rule out a wrong mean function. In the PDF's first residual-versus-fitted plot, residuals are negative at both ends and positive in the middle. This curved pattern agrees with the visibly flattening output-versus-velocity relationship and motivates a polynomial regression with a quadratic term.
The second wind model is , again with independent common-variance normal errors. Its fitted mean is . The line marked (A) is a two-sided Student t-test of against , conditional on retaining the intercept and linear term. Under the null hypothesis,
Its two-sided p-value is . This is far below , so reject a purely linear mean in favour of the quadratic fit. Equivalently, the extra-term nested-model F-test has and null law .
The third fit is a reciprocal-predictor regression, , with estimated mean . It has two mean parameters rather than the quadratic model's three. Its residual standard error is smaller, versus , and its coefficient of determination is larger, versus . The corresponding residual sums of squares are approximately and . The reciprocal fit is preferable on both these fit measures and parsimony. The two models are not nested, so an ordinary extra-term F-test between them is inappropriate. On the common normal-error likelihood, the difference also favours the third model.
Neither lower residual sum of squares nor a higher coefficient of determination establishes adequate assumptions. The quadratic residual-versus-fitted plot removes the original pronounced curvature; the reciprocal plot also has no comparably obvious mean trend. The low-output residuals appear somewhat more spread out, so check scale-location plots and residuals against velocity for heteroscedasticity. Q-Q plots assess normality; residuals against observation order assess serial dependence; regression leverage and Cook's distance identify influential observations. Further cross-validation, replicate observations at comparable velocities, and prediction errors would help choose between their extrapolation behaviours. Both fitted shapes should be judged principally over the observed positive-velocity range.
The fitted values are , so the hat matrix is
It is symmetric, and
It fixes every vector in the column space of , and annihilates its orthogonal complement. Thus is the orthogonal projection onto that column space, has matrix rank and trace , and is the complementary orthogonal projection. Consequently
Since , the covariance matrix between the regression residual vector and the coefficient estimate is
These quantities have a joint normal distribution, so they are also independent, a stronger conclusion than zero covariance.
Now has mean zero. Using the expectation of a quadratic form,
Thus the maximum-likelihood estimator has
The unbiased alternative is
The orthogonal projection of a Gaussian vector also yields , explaining the residual degrees of freedom.
The dashed curves are contours of constant Cook's distance, labelled 0.5 and 1, in the plot of standardized residual against regression leverage. Writing for the diagonal of the hat matrix, for the residual variance estimate, and for the number of fitted coefficients,
Thus a contour has . On the actual PDF plot, observation 579 has leverage about 0.084 and standardized residual about , lying beyond the contour and below in influence magnitude, approximately to from the plotted coordinates. It is unusually light relative to its fitted log-weight and potentially influential because deleting it can materially change fitted coefficients. It warrants checking, not automatic deletion. The solid smooth red curve is distinct from the dashed Cook's distance contours.
Minimizing gives the normal equations . Full column rank makes invertible, so
With the hat matrix , the residual is . The symmetric projection has rank , hence
and the latter estimator is unbiased.
For the residual-versus-fitted plot, compute fitted values and regression residuals ; the plotted point is .
For the normal Q-Q plot, let be the hat matrix for the full three-column design matrix and let . Form the standardized regression residuals
and order them as . R plots against , where are its plotting positions. For , ; is the standard normal distribution function. This standardization is specified in R's diagnostic-plot documentation.
The original PDF shows a residual cloud around zero without compelling systematic curvature or a clear funnel, and a Q-Q pattern approximately following the reference line. Observations 81 and 83 are conspicuous positive tail points, with a smaller lower-tail departure. The plots show no decisive violation of linearity, constant variance or normality, but the extreme residuals merit inspection. They do not test independence across observations and cannot establish that all model assumptions hold.
The hat matrix is an orthogonal projection of rank , so is an orthogonal projection of rank . Because is a standard multivariate normal distribution vector, Cochran's theorem gives
Thus . Substituting this into the preceding formula gives the Distribution of the Akaike information criterion in a normal linear model:
Let
be the hat matrix. Then
depends only on the orthogonal projection , while
depends only on the orthogonal residual projection .
The random vectors and are jointly multivariate normal, and their cross-covariance is
Uncorrelated jointly Gaussian vectors are independent. Therefore
Write
where and are independent, centered, and have covariance matrix . Then
The deterministic term is orthogonal in expectation to the two centered random terms, and the random terms are independent. Since the hat matrix is a symmetric idempotent projection of rank ,
while . Therefore
In this bias-variance decomposition for linear prediction, is squared model bias, is variance from fitting coefficients, and is irreducible noise in the future response. Enlarging the model tends to reduce the first term while increasing the fitted-model variance, which is the bias-variance tradeoff.
Standardized regression residual Created 2026-10-05 Updated 2026-10-06
In a normal linear model, the th regression residual has variance , where is a diagonal entry of the hat matrix. Replacing by the residual standard deviation gives the standardized residual used in the normal Q-Q plot of R's linear-model diagnostic plots.