Residual plot 2026-10-25
A residual plot displays regression residuals against fitted responses, predictor values or observation order. Curvature can suggest an incorrect regression function; changing spread can suggest unequal error variances; ordered runs can suggest dependence. A plot is a diagnostic, not a proof of independence. Dependence confined to higher moments, as for adjacent products of independent Gaussian variables, may call for lagged squared regression residuals rather than a basic scatter plot. Fitting also induces dependence among regression residuals even under independent original errors.
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, then
It 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]
Residual-versus-fitted plot Created 2026-10-05 Updated 2026-10-14
A residual-versus-fitted plot displays residuals vertically against predicted responses horizontally. Curvature suggests an incorrect conditional-mean model; a fan-shaped spread suggests heteroscedasticity, while isolated large residuals may indicate unusual observations. It does not alone measure leverage or influence: regression leverage records unusual predictor combinations, and Cook's distance combines leverage and residual size.
The figure in coefficient of determination shows why the plot is useful: subtracting the fitted linear trend makes a small curved component easy to see. A visible pattern supplies a reason to investigate the model, while the absence of a pattern in a small sample does not establish that all assumptions hold. Other views address other questions: regression residuals against observation order can reveal temporal dependence, and a normal probability plot examines distributional shape. NIST's statistical handbook develops this use of graphical residual analysis for model validation. [ref]
The 1975 experiment mixed powdered sodium chloride and 0.5%-chromium ruby in a 4:1 volume ratio. An Inconel gasket, initially thick with a hole, held the powder and 4:1 methanol–ethanol. At , X-ray diffraction rings on film away gave salt compression; a reference equation of state assigned pressure. After decreasing load, they waited at least five hours and bracketed diffraction exposures with readings to check drift.[ref]
The recommended linear slope was , with a fit confidence interval of , to . Reference-scale systematic measurement uncertainty remained separate. Above about the medium was only quasihydrostatic; separate range fits checked consistency.[ref]
The logical chain is compression to reference pressure, paired with optical shift, then a fitted response. X-ray diffraction supplies the reference comparison during calibration; subsequent ruby readings transfer that scale to other samples. The reference equation of state is therefore part of the meaning of the reported pressure. Changing it can move all calibrated readings together, even if the optical measurements repeat perfectly. A regression residual tests agreement with the chosen reference within the sampled conditions; it cannot independently certify that reference.
Construct a synthetic local calibration to show the calculation independently of the historical data. Choose reference pairs , with shifts in and pressures in . The reference zero is already subtracted. Treat the shifts as exact for this fit and give the three reference pressures equal weights. Minimizing the ordinary least squares objective
and setting its derivative to zero gives
The regression residuals are . Their weighted moment vanishes, as required by the least-squares normal equations. An unknown reference offset requires fitting an intercept instead; forcing it to zero can bias the slope. If shift errors matter, this elementary fit is insufficient.
Figure 1.
Synthetic ruby pressure scale: fitting the response and propagating measurement uncertainty
. Original stipulated reference points and calculations, not measured historical calibration. The left panel shows the fitted slope and a chosen reading. The right panel separates independent contributions to standard uncertainty; bar lengths are standard contributions, which combine by sums of squares. The assigned slope standard uncertainty includes a hypothetical reference-scale contribution and is not estimated from the three residuals. Details.
Use the local measurement model
Here denotes pressure relative to the reference, is calibrated sensitivity, and is a local wavelength sensitivity to temperature at fixed pressure. Choose , and a reading at . The inferred pressure is . These coefficients and readings are stipulated, not measured ruby constants. With the same pressure, a increase in temperature would add to the shift in this model; neglecting it would overestimate pressure by .
Assign independent standard uncertainties , and for the temperature difference. Here is an independently assigned calibration uncertainty, not an estimate from the regression residuals above; treat as exact in this example. First-order propagation of uncertainty follows by differentiating the measurement model:
The four standard contributions are , giving . This is a standard uncertainty, not automatically a interval. Correlated reference and loaded wavelength readings require the corresponding covariance term; common wavelength-axis drift may cancel in their difference. Uncertain , nonzero , model inadequacy and unresolved deviatoric stress require a broader budget. Taking more optical readings reduces some random errors while leaving a common reference-scale error.
Standardized regression residual Created 2026-10-05 Updated 2026-10-14
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.
Sum of squares 2026-10-13
A sum of squares adds the squares of numbers for specified real numbers . It is nonnegative and vanishes exactly when every term is zero. For the coordinates of a vector, it is the squared Euclidean norm; for regression residuals, it gives the residual sum of squares minimized by ordinary least squares.
Tensile modulus experiment Created 2026-10-18 Updated 2026-10-20
MIT's Spring 2004 laboratory assignment Properties of Heat Treated Steel gives a concrete tensile testing protocol. Record transducer channels and calibration factors; measure specimen diameter and length, and the extensometer gauge length with its locking pin inserted. Zero the load cell, pin the threaded grips into their adapters, and attach the extensometer centrally. Apply the specified seating load, record actuator position, then acquire readings every second while moving at about . The handout derives engineering stress from load cell force, engineering strain from extensometer deformation, and Young's modulus by linear regression below the proportional limit; it warns that actuator-derived strain includes apparatus deformation.[ref]
For a modulus-focused measurement, select a load window after seating, hold temperature and loading rate consistent, and record force, local extension and crosshead displacement together. Fit within that window and calculate . Inspect the regression residuals for curvature; repeat at a lower maximum load and include unloading to check elastic deformation. These are diagnostic additions to the cited protocol, whose full test continues through failure. The handout's seating load is specific to its specimens and apparatus, rather than a universal preload.
Figure 1.
Three readouts in a tensile experiment: force, local extension and actuator travel
. Original functional schematic. The load cell reads the axial force; two extensometer contacts define the gauge length inside the specimen. A separate actuator displacement readout spans a load path that includes the specimen and deformable grips and frame. The adjacent series model separates specimen extension from machine extension. Shapes are schematic and are not a dimensional reconstruction of MIT's apparatus. Details.
An extensometer measures the change between its contact points; crosshead displacement measures travel of the machine's moving member. The manufacturer Instron explicitly distinguishes local strain from travel that includes machine deformation and machine compliance.[ref] The gauge length can be shorter than the uniform length between grips. Thus even a perfectly rigid machine generally has : the local instrument sees only its own segment. Do not divide one channel's extension by the other channel's reference length.
Grips must transmit axial force without slip. Misalignment adds bending moment and makes opposite sides experience different axial strains; an instrument on just one side may then report a biased modulus. A changing extension offset, hysteresis between loading and unloading, or load-dependent fitted slope is evidence to investigate seating, slip or material response. A straight line over a short interval alone does not identify which is responsible.
Training error Created 2026-09-24 Updated 2026-10-14
Training error is the average loss function evaluated on the observations used to fit the prediction rule. It is the empirical risk of the fitted rule on its own training data. With squared-error loss, it is the average squared regression residual, measuring fit to observed responses rather than performance on fresh responses. Flexible fitting usually makes it optimistically biased for prediction error, as quantified by prediction optimism.
For a reproducible polynomial regression example, take , , and the known noiseless target . Construct responses with fixed disturbances
Ordinary least squares over polynomials of polynomial degree at most 1, 2, and 7 gives training errors , , and . The monotone improvement follows because these candidate families are nested: every smaller-degree fit remains available in the larger family. This argument concerns minimum training error, not generalization, and assumes the fitting mathematical optimization is solved. Degrees 2 and 7 fitted instead to the exact noiseless responses have mathematically zero training error; the script obtains approximately and from rounding. Extra flexibility alone does not force overfitting.
Prepare two uniform specimens with the same material, direction and , but different deforming lengths . Keep grip engagement, adapters, loading window and measurement configuration equivalent. Determine separately by linear regression with its own displacement intercept. Subtracting the two series equations eliminates the common machine compliance:
This is an inverse problem: one length supplies only one equation for two unknowns, while two distinct lengths separate the length-dependent specimen contribution from the constant contribution. In a graph of compliance against length, the slope is and the vertical intercept is . It is the compliance, not , that is linear in .
The dimensional analysis is revealing: , so . For , the ideal model requires . A negative fitted challenges the common-intercept assumptions or the measurements. Two lengths determine two parameters exactly, so they cannot test the assumed straight line; three or more lengths allow regression residuals to reveal departures. Nearly equal lengths amplify slope errors through the small difference . If the actual apparatus compliances differ by , the inferred length slope becomes .
Fitting a mixture model to regression residuals treats the fitted mean adjustment as fixed. Even with independent homoscedastic errors, ordinary least-squares residuals have covariance matrix and satisfy fitted linear constraints, so they are not exactly independent observations. A joint mixture regression with shared slopes or a bootstrap of the whole fitting process better accounts for the first-stage estimation uncertainty.
Universal kriging Created 2026-10-05 Updated 2026-10-18
Universal kriging allows an unknown regression drift:
The design matrix has full column rank, its entries and are known, and the regression coefficients are unknown. For example, rows and target row allow a linear spatial trend. Requiring to have zero bias for every gives . With known positive-definite matrix observation covariance matrix , the minimizing weights solve
where is a vector of Lagrange multipliers. Equivalently, the generalized least squares estimate and prediction are
The first term is the estimated trend alone; the second predicts the correlated regression residuals. With , the error variance is
The last, nonnegative term accounts for estimating the specified drift coefficients. Merely inserting a fitted drift into simple kriging and keeping its known-mean error variance would omit this term. For a Gaussian random field, the same expressions arise by integrating over drift coefficients in a diffuse prior distribution limit; this is an additional inferential interpretation, not an assumption required by the linear optimization.[ref]