UK-based online statistics and data analysis support for USA, UK, and international clients. No exams, no impersonation, no fabricated data.
Residual shape, model specification, influence and case-level verification

Regression Residual Analysis: Formulas, Diagnostic Plots, Thresholds and Interpretation

Regression Residual Analysis examines the errors left after a regression model is fitted. This complete worked guide evaluates a five-predictor model for final grade G3 using residual plots, normality checks, heteroscedasticity tests, specification testing, leverage, Cook’s distance, DFFITS, COVRATIO and documented case review in Python, R, SPSS and Excel.

649 fitted cases5 predictors10 Python diagnostic charts66 unique flagged cases

Regression Residual Analysis Model Overview

Regression Residual Analysis is the systematic study of observed-minus-predicted errors after a regression equation has been estimated. The purpose is not merely to calculate a residual column. The purpose is to determine whether the fitted mean structure is credible, whether uncertainty is being estimated under reasonable conditions, whether a small number of observations has disproportionate influence, and whether the final scientific or practical conclusion remains stable when legitimate diagnostic concerns are addressed.

The worked research question is: Does the linear model that predicts final grade G3 from G1, G2, studytime, failures and absences provide an adequate and stable representation of the 649 complete observations? The fitted equation has strong average explanatory power, with R² = 0.850563 and adjusted R² = 0.849401. However, Regression Residual Analysis asks a different question from model fit alone. It examines what the model fails to explain, how those failures are distributed, and whether the reported slopes and intervals are sensitive to functional form, nonconstant variance or influential cases.

What Is Regression Residual Analysis?

For observation i, the raw residual is the observed outcome minus the fitted outcome. A positive residual means the model underpredicted G3; a negative residual means the model overpredicted G3. Residuals are expressed in outcome units, so a raw residual of 2 means the recorded final grade was two points above the fitted value. Standardized and studentized residuals place that error on a scale that accounts for residual spread and, in different ways, leverage.

eᵢ = yᵢ − ŷᵢ

The fitted value comes from the declared five-predictor equation. Every residual, leverage value and influence statistic in this article is model-specific. Adding a predictor, changing a transformation, removing the intercept or changing the eligible rows changes the fitted values and therefore changes the entire Regression Residual Analysis.

ŷ = −0.155190 + 0.139457(G1) + 0.885709(G2) + 0.096699(studytime) − 0.218290(failures) + 0.023367(absences)

What Question Does Regression Residual Analysis Answer?

Regression Residual Analysis answers whether the residual behavior is compatible with the claims attached to the fitted regression. It evaluates linearity of the conditional mean, constancy of residual variance, approximate distributional behavior for conventional inference, dependence at the relevant observation order, and case influence. It also separates four ideas that are often confused: a response outlier can have a large residual, a high-leverage observation can have an unusual predictor combination, an influential observation can materially change estimates, and an erroneous observation is one contradicted by the source record. These categories overlap, but they are not interchangeable.

When Should Regression Residual Analysis Be Used?

Use it when

  • A linear or generalized regression model will be interpreted, reported or used for prediction.
  • R², coefficients or p-values look persuasive but the adequacy of the fitted equation has not been checked.
  • The outcome may contain unusual values, boundaries, floor effects or ceiling effects.
  • Predictor combinations may create high leverage or case influence.
  • Conventional standard errors and confidence intervals depend on variance or distribution assumptions.
  • A transparent case-review and sensitivity record is required for publication or professional work.

Do not use it as

  • An automatic deletion system for every observation beyond a threshold.
  • A substitute for choosing the correct regression family and link function.
  • Proof of causality, measurement validity or correct data collection.
  • A guarantee of independence when the sampling design contains clusters or repeated measurements.
  • A reason to transform variables until every plot appears visually perfect.
  • A collection of disconnected tests without a documented decision rule.

Why Use It Instead of R² Alone?

R² summarizes the proportion of sample variation in G3 represented by the fitted values. It does not test whether residual variance is constant, whether the functional form is adequate, whether tails are approximately normal, or whether a few observations dominate the coefficients. In this example, R² is approximately 0.85, yet the Ramsey RESET test, Breusch–Pagan test, White test, Shapiro–Wilk test and Jarque–Bera test all identify important conflicts. The model therefore has a useful conditional mean while still requiring cautious inference and specification review.

How the Diagnostic Quantities Work

Residual sizeRaw, standardized and deleted studentized residuals measure how surprising the outcome is under the fitted equation.
Design rarityLeverage measures how unusual an observation’s predictor combination is relative to the rest of the design matrix.
InfluenceCook’s distance, DFFITS and COVRATIO estimate how much fitted results or coefficient precision change when a case is omitted.
hᵢᵢ = diagonal element of H, where H = X(X′X)⁻¹X′
Externally studentized residual: tᵢ = eᵢ / [s₍ᵢ₎√(1 − hᵢᵢ)]
Cook’s distance: Dᵢ = [eᵢ² / (p·MSE)] × [hᵢᵢ / (1 − hᵢᵢ)²]

Here, p is the number of fitted coefficients including the intercept, so p = 6. The article uses transparent screening lines rather than universal pass/fail laws: leverage above 2p/n, Cook’s distance above 4/n, absolute DFFITS above 2√(p/n), externally studentized residual magnitude above 3, and COVRATIO outside 1 ± 3p/n. These thresholds prioritize cases for review; they do not establish invalidity.

How Residuals, Coefficients and Predictions Are Interpreted

A residual describes one observation’s signed error under the fitted equation. A coefficient describes the expected change in fitted G3 associated with a one-unit predictor increase while the other included predictors are held constant. A predicted value is the conditional mean generated by the equation for a specified predictor profile. Influence statistics describe how much the estimated model would change if an observation were omitted. Regression Residual Analysis keeps these scales separate so that a large residual is not mistakenly interpreted as a large coefficient and a high-leverage point is not automatically labeled an outcome outlier.

How Regression Residual Analysis Differs from Related Methods

Regression Residual Analysis is broader than a normality test because it also evaluates form, variance, dependence and influence. It is broader than an outlier check because it distinguishes unusual outcomes from unusual predictor profiles. It differs from robust regression, which changes the estimation rule, and from heteroscedasticity-consistent standard errors, which change the estimated covariance matrix without changing fitted values. It also differs from cross-validation, which evaluates performance on held-out observations. A defensible workflow may use all of these tools, but each answers a different question.

Supported Variables and Model Types

The core logic of Regression Residual Analysis applies to continuous-outcome linear regression and extends, with model-specific residual definitions, to logistic, Poisson, negative binomial, ordinal, survival and multilevel models. The present worked example is ordinary least squares with one continuous outcome and five numeric or ordered predictors. Raw, standardized and studentized residuals are therefore interpreted on the linear-model scale. Deviance and Pearson residuals would be more appropriate for many generalized linear models.

Assumptions and Requirements

Correct outcome and regression family

The equation should match the scale and support of G3. A bounded grade outcome can still be analyzed by OLS for a conditional-mean question, but boundary compression and nonlinearity must be examined rather than ignored.

Fixed model specification during diagnosis

The formula, intercept convention, coding, complete-case rule and row order must remain fixed while residual and influence quantities are compared across software.

Independent observational units

Durbin–Watson cannot replace design knowledge. Repeated students, classroom clusters or temporal ordering require models that represent those dependencies.

Adequate mean structure

Residuals should not retain systematic curvature after the chosen predictors and transformations are included. The significant RESET result makes this requirement a central issue in the worked analysis.

Variance appropriate for the intended inference

Constant variance is required for conventional homoscedastic OLS standard errors. Point estimates remain OLS estimates under heteroscedasticity, but conventional uncertainty can be misleading.

Documented case-review rules

Thresholds must be defined before selective deletion. Valid unusual observations should normally remain in the primary analysis, with sensitivity results reported separately.

Advantages and Limitations

Advantages

  • Connects visual patterns to exact tests and case-level values.
  • Separates outlier, leverage, influence and data-error concepts.
  • Supports transparent sensitivity analysis instead of hidden cleaning.
  • Improves reporting of model limitations and uncertainty.
  • Can be reproduced across Python, R, SPSS and Excel.

Limitations

  • No diagnostic proves that a model is correct.
  • Large samples can make small departures statistically significant.
  • Thresholds are screening conventions, not scientific constants.
  • Plots require judgment and can be affected by scale or overplotting.
  • Remedies such as transformations or deletion can create new interpretation problems.

Model-Review and Remedy Logic

The correct sequence is to fit the prespecified equation, verify coding and rows, inspect broad residual patterns, run formal checks, review case-level influence, identify the likely mechanism, and then compare a scientifically justified alternative. Nonlinearity may call for transformations, interactions, polynomial terms or splines. Heteroscedasticity may call for HC3 uncertainty, weighted least squares or an explicit variance model. Clustering may call for multilevel or cluster-robust methods. Influence may call for source verification and sensitivity analysis. The remedy must target the diagnosed mechanism rather than simply make one plot look cleaner.

Current Worked Scenario

The worked Regression Residual Analysis uses 649 complete observations and the formula G3 ~ G1 + G2 + studytime + failures + absences. The model has R² = 0.850563, adjusted R² = 0.849401, RMSE = 1.253722 and F(5, 643) = 731.965860, p = 1.326 × 10−262. Residual independence is not strongly contradicted by Durbin–Watson = 1.857347 for the retained order. However, RESET F = 9.868464, p = 0.001759 indicates possible functional-form error; Breusch–Pagan = 30.129021, p = 1.391 × 10−5 and White = 66.454172, p = 6.832 × 10−7 indicate nonconstant variance; and the normality checks identify strong tail departure.

Worked conclusion: Regression Residual Analysis shows that the five-predictor equation has strong average fit but does not fully satisfy the assumptions used for conventional uncertainty and tail prediction. The primary data should not be automatically reduced by deleting all 66 flagged observations. The defensible response is source verification, robust uncertainty, mean-structure review and documented sensitivity analysis.

Quick Answer

Model R²0.850563
Model RMSE1.253722
Durbin–Watson1.857347
Unique cases with any flag66

What the fitted model supports

The five predictors provide a strong description of the conditional mean of G3 in the fitted sample.

  • N = 649 complete observations
  • R² = 0.850563
  • Adjusted R² = 0.849401
  • F(5, 643) = 731.965860
  • Overall p = 1.326 × 10−262
  • RMSE = 1.253722 grade points

What Regression Residual Analysis changes

The diagnostic evidence limits how confidently conventional intervals and tail predictions should be interpreted.

  • RESET p = 0.001759
  • Breusch–Pagan p = 1.391 × 10−5
  • White p = 6.832 × 10−7
  • 10 externally studentized residual outliers
  • 29 Cook’s-distance flags
  • 66 distinct cases with at least one screening flag
Main interpretation: a high R² and a highly significant overall F test do not cancel the diagnostic conflicts. Regression Residual Analysis supports retaining the informative mean model while revising the inferential strategy and examining plausible nonlinear structure.
Non-deletion rule: none of the supplied thresholds proves that a row is erroneous. A case should be corrected or excluded only after source verification and a documented eligibility rule, not because software colored it red.

Table of Contents

  1. Why this analysis needs Regression Residual Analysis
  2. How Regression Residual Analysis works
  3. Variables, coding and data dictionary
  4. Verified Regression Residual Analysis results
  5. Ten Python chart stories
  6. R charts and paired explanations
  7. Coefficient interpretation
  8. Predictions and worked residual calculations
  9. Assumptions and diagnostic decisions
  10. Python, R, SPSS and Excel workflows
  11. Expandable software code
  12. 26 advanced Regression Residual Analysis topics
  13. APA-style reporting
  14. Publication checklist
  15. Downloads and chart resources
  16. Related Salar Cafe guides
  17. 16 frequently asked questions
  18. Regression Residual Analysis conclusion

Why This Analysis Needs Regression Residual Analysis

Strong fit can hide misspecificationR² = 0.850563 describes average fit, but RESET p = 0.001759 indicates that the linear mean structure may be incomplete.
Uncertainty can be miscalibratedBoth Breusch–Pagan and White tests flag heteroscedasticity, so conventional homoscedastic standard errors deserve caution.
Cases affect the model differentlyResidual outliers, high leverage and influence are different mechanisms and require different verification steps.

The five-predictor model is statistically strong enough that a reader could be tempted to stop after the coefficient table. That would miss the central finding of Regression Residual Analysis: the fitted conditional mean is useful, but the remaining errors are not behaving like an uncomplicated homoscedastic Gaussian linear model. Strong negative tail observations affect normality, changing spread affects conventional precision, and possible curvature affects the meaning of a single straight-line slope over the fitted range.

The diagnostic workflow is especially necessary because 66 observations meet at least one screening rule, while the individual flag totals sum to far more than 66. The overlap reveals why counts must be kept at case level. One observation may have high leverage, cross the DFFITS threshold and alter COVRATIO without having an externally studentized residual beyond ±3. Another observation may be a severe response outlier with ordinary leverage. Regression Residual Analysis prevents those cases from being treated as if they represented one problem.

Questions answered here

  • Are residuals centered without a systematic curve?
  • Does residual spread remain reasonably stable?
  • Are tail departures important for conventional inference?
  • Which cases have unusual predictor profiles?
  • Which cases materially change fitted results?
  • What remedy targets the observed diagnostic mechanism?

Questions not answered here

  • Whether the predictors cause changes in G3.
  • Whether a flagged record is incorrect without source evidence.
  • Whether omitted variables are absent from the data-generating process.
  • Whether the model will generalize without held-out validation.
  • Whether row order represents time, classroom or another dependence structure.
  • Whether a transformed model is substantively preferable before interpretation is considered.
Best-use statement: use Regression Residual Analysis whenever regression coefficients, intervals or predictions will be communicated. Report the model and its diagnostic limitations together rather than presenting diagnostics as an optional appendix.

How Regression Residual Analysis Works

Step 1Freeze and fit the model

Confirm the outcome, predictors, coding, intercept, complete-case rule and observation order before calculating diagnostics.

Step 2Calculate residual evidence

Obtain fitted values, residual scales, leverage, Cook’s distance, DFFITS, COVRATIO and formal specification tests.

Step 3Verify and decide

Link plots to exact values, inspect source records, choose a mechanism-specific remedy and document sensitivity results.

1. Fit the Declared Equation

G3ᵢ = β₀ + β₁G1ᵢ + β₂G2ᵢ + β₃studytimeᵢ + β₄failuresᵢ + β₅absencesᵢ + εᵢ

The fitted equation produces one predicted G3 value for every complete row. The intercept and five slopes are estimated simultaneously. The resulting residual vector is orthogonal to each included predictor in the ordinary least-squares sample, but that algebraic property does not guarantee normality, constant variance or a correct functional form.

2. Preserve the Residual Sign

Raw residual = observed G3 − predicted G3

Positive values mean underprediction and negative values mean overprediction. The sign is essential. Taking absolute values is useful for magnitude displays such as scale-location plots, but it removes direction and therefore cannot replace the signed residual-versus-fitted graph.

3. Place Errors on Comparable Scales

Internally standardized residual ≈ eᵢ / [s√(1 − hᵢᵢ)]
Externally studentized residual = eᵢ / [s₍ᵢ₎√(1 − hᵢᵢ)]

The deleted estimate s(i) excludes the focal observation when estimating residual spread. This makes the externally studentized residual especially useful for screening severe response outliers. In the worked Regression Residual Analysis, ten cases exceed |tᵢ| > 3 and the maximum absolute value is 7.581732.

4. Measure Leverage and Influence

QuantityPrimary questionWorked review ruleFlagged cases
Leverage hᵢᵢIs the predictor profile unusual?hᵢᵢ > 2p/n = 0.0184899847
Cook’s distanceDoes deletion change the fitted coefficient vector materially?Dᵢ > 4/n = 0.0061633329
|DFFITS|Does deletion change the focal fitted value?|DFFITS| > 2√(p/n) = 0.1923017729
COVRATIODoes deletion change joint coefficient precision?Outside 0.97226502 to 1.0277349849
|Externally studentized residual|Is the observed outcome unusually far from its fitted value?|tᵢ| > 310

5. Test Model Form and Variance

The Ramsey RESET test adds functions of the fitted values to determine whether the original linear predictor may omit nonlinear structure. The Breusch–Pagan and White tests examine whether residual variance is associated with the fitted design. These tests do not reveal the scientifically correct alternative, so their results must be combined with plots and theory.

6. Consolidate Flags at Case Level

Each threshold creates a Boolean flag. The union across flags contains 66 unique observations. Adding 10 + 47 + 29 + 29 + 49 would be incorrect because many rows cross more than one rule. A case-level matrix should retain the original row identifier, observed outcome, fitted value, raw residual, studentized residual, leverage, influence measures and the specific rules crossed.

7. Select a Mechanism-Specific Response

For the present Regression Residual Analysis, the strongest broad responses are to calculate heteroscedasticity-consistent uncertainty, investigate nonlinear terms supported by subject knowledge, retain valid unusual observations in the primary model, and report a limited sensitivity analysis for the most influential verified cases. Deleting every flagged row would change the target population and could produce an artificially tidy model.

Variables Used, Coding and Data Dictionary

The worked Regression Residual Analysis keeps the same 649 complete rows, variable meanings and coding rules in every software workflow. G3 is the continuous outcome. G1, G2, studytime, failures and absences are entered as additive predictors with an intercept.

VariableModel roleMeaningCoding and interpretation
G3OutcomeFinal course gradeContinuous observed outcome used to calculate fitted errors; residual = observed G3 − fitted G3.
G1PredictorFirst-period gradeNumeric grade. Its slope is the adjusted expected difference in G3 for a one-point increase.
G2PredictorSecond-period gradeNumeric grade. It is the dominant adjusted predictor in the fitted equation.
studytimePredictorOrdered weekly study-time categoryEntered as a one-unit numeric step. The coefficient assumes equal linear spacing between category codes.
failuresPredictorNumber of prior class failuresCount predictor. A one-unit increase is associated with a lower fitted G3 after adjustment.
absencesPredictorSchool absence countCount predictor. The positive adjusted slope is small and should not be interpreted causally.
Coding caution: studytime is an ordered category treated as a linear numeric predictor. The significant RESET result is one reason to investigate whether that and other predictor effects are adequately represented by straight-line terms.
Sample rule: all reported model and diagnostic values use 649 complete observations. Changing missing-data handling changes n, thresholds, fitted values and every case-level flag.

Regression Residual Analysis Results

Observations649

Complete cases used throughout

Predictors5

Six fitted coefficients including intercept

0.850563

Strong fitted-sample mean representation

Adjusted R²0.849401

R² adjusted for model size

RMSE1.253722

Error magnitude in G3 grade units

Any diagnostic flag66

Unique observations, not summed flags

Verified Model Fit

ResultExact valueInterpretation
Model formulaG3 ~ G1 + G2 + studytime + failures + absencesAll diagnostic quantities refer to this exact additive OLS equation.
N649Complete observations retained in the analysis.
0.8505634419896496Approximately 85.06% of fitted-sample G3 variation is represented by the model.
Adjusted R²0.8494014158775940Fit adjusted for the five predictors.
F statistic731.9658596010541The predictor set is jointly associated with G3.
Overall model p1.3257355956912994 × 10−262The null that all five slopes equal zero is rejected.
RMSE1.2537218471492084Typical squared-error scale is about 1.25 grade points.

Formal Diagnostic Tests

DiagnosticStatisticp-valueWorked interpretation
Ramsey RESETF = 9.8684638088544840.0017586743578903211Potential omitted nonlinear structure or functional-form error.
Breusch–Pagan30.1290207773202181.391073405033745 × 10−5Residual variance is not adequately described as constant.
White test66.454171753100526.831804065114402 × 10−7A broader heteroscedasticity check also rejects constant variance.
Shapiro–WilkW = 0.75657220655349487.721862065650793 × 10−30Residual distribution differs strongly from a normal reference.
Jarque–Bera10019.316609810166Reported as 0 by numerical outputSkewness and/or kurtosis departure is extreme; the value should be described as below machine display precision, not literally impossible.
Durbin–Watson1.857347495275311Not a conventional p-value test hereNear two for the retained order, but design-based independence still requires substantive verification.

Residual and Influence Screening

ScreenThresholdFlag countMaximum or rangeMeaning
Externally studentized residual|tᵢ| > 310Maximum |tᵢ| = 7.581732246108437Large outcome error after deletion-based scaling.
Leveragehᵢᵢ > 0.0184899845916795147Maximum hᵢᵢ = 0.10328893304355637Unusual predictor profile.
Cook’s distanceDᵢ > 0.00616332819722650329Maximum Dᵢ = 0.20287792240404778Joint coefficient influence.
DFFITS|DFFITS| > 0.1923017659392628229Maximum |DFFITS| = 1.1507368236586064Influence on the focal fitted value.
COVRATIOOutside 0.9722650231124808–1.027734976887519249Both lower and upper departures occurInfluence on joint coefficient precision.
Any diagnostic flagUnion of all rules66Overlapping categoriesDistinct observations requiring prioritized review.
Results conclusion: Regression Residual Analysis identifies a high-performing mean model with meaningful violations of linear-model diagnostics. The result supports refinement and robust inference, not automatic rejection of the entire model.

Ten Python Regression Residual Analysis Chart Stories

Each Python figure is interpreted through the same four-part structure: visible pattern, exact key values, statistical interpretation and why the evidence matters for the next modeling decision. All charts use the same 649-row, five-predictor equation.

Python Chart 1: Residuals Versus Fitted Values

Regression Residual Analysis residuals versus fitted plot
Raw residuals plotted against fitted G3 values for the five-predictor model. This figure is part of the worked Regression Residual Analysis.
Pattern

The point cloud is centered around the zero line, but the spread and local pattern are not fully uniform across fitted values. Integer-valued grades create visible bands, while extreme negative errors extend farther from zero than most positive errors.

Key values

The graph contains all 649 residuals from the model with R² = 0.850563 and RMSE = 1.253722. RESET is F = 9.868464, p = 0.001759; Breusch–Pagan and White p-values are 1.391 × 10−5 and 6.832 × 10−7.

Interpretation

Residual centering alone is not enough. The formal tests indicate that both the conditional-mean form and variance structure deserve review. Horizontal grade bands are expected for an integer outcome, but systematic curvature or changing envelope width is diagnostic.

Why it matters

This is the broadest first figure in Regression Residual Analysis. It directs the analyst toward nonlinear terms, robust uncertainty and closer inspection of the cases producing the largest negative residuals.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 2: Normal Q–Q Plot

Regression Residual Analysis normal Q-Q plot
Ordered model residuals compared with theoretical normal quantiles. This figure is part of the worked Regression Residual Analysis.
Pattern

The central portion follows the reference line more closely than the tails. The most pronounced departure occurs in the lower tail, where several observations are much more negative than a normal residual model would predict.

Key values

Shapiro–Wilk is W = 0.756572 with p = 7.722 × 10−30. Jarque–Bera is 10019.316610, with the p-value displayed as zero by the numerical output. The maximum absolute externally studentized residual is 7.581732.

Interpretation

The tail pattern is not a trivial cosmetic departure. It affects conventional small-sample reference assumptions and prediction intervals, even though OLS fitted values and slopes remain algebraically computable.

Why it matters

Regression Residual Analysis should respond by reporting the departure, checking source records for extreme cases, and considering HC3, bootstrap or other robust inference rather than deleting observations to force a straight Q–Q line.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 3: Residual Histogram

Regression Residual Analysis residual histogram
Distribution of raw residuals from the worked five-predictor equation. This figure is part of the worked Regression Residual Analysis.
Pattern

Most residuals are concentrated around zero, while a comparatively sparse but long negative tail creates strong asymmetry and excess tail weight. The center can look compact even when a few observations dominate formal normality tests.

Key values

The fitted model has RMSE = 1.253722. Ten observations exceed |externally studentized residual| > 3, and the largest absolute externally studentized residual is 7.581732.

Interpretation

The histogram explains why average error can remain modest while residual normality fails sharply. A small set of severe misses can coexist with accurate predictions for the majority of observations.

Why it matters

The figure matters for reporting prediction uncertainty and for deciding whether a robust or bounded-outcome approach should be compared. Bin width should not be used to hide the tail.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 4: Scale–Location Plot

Regression Residual Analysis scale-location plot
Square-root absolute standardized residual magnitude across fitted G3 values. This figure is part of the worked Regression Residual Analysis.
Pattern

The vertical spread changes across the fitted-value range rather than forming a completely flat band. Because positive and negative signs are removed, changes in error magnitude are easier to see than in the ordinary residual plot.

Key values

Breusch–Pagan is 30.129021, p = 1.391 × 10−5. White is 66.454172, p = 6.832 × 10−7. Both tests independently flag nonconstant variance.

Interpretation

The conventional OLS coefficient estimates describe the fitted linear mean, but standard errors calculated under homoscedasticity may not reflect the observed variance pattern.

Why it matters

This Regression Residual Analysis result supports reporting HC3 or another justified robust covariance estimate and comparing whether substantive conclusions change. A variance remedy should be documented separately from a mean-structure remedy.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 5: Studentized Residuals Versus Leverage

Regression Residual Analysis studentized residuals versus leverage
Externally or internally studentized error magnitude positioned against leverage for every case. This figure is part of the worked Regression Residual Analysis.
Pattern

Most observations occupy the low-leverage central area, but several cases extend horizontally because their predictor profiles are unusual. Severe vertical departures identify response outliers; cases that are both horizontally and vertically unusual deserve the highest review priority.

Key values

The leverage review line is 0.01848998; 47 cases exceed it and the maximum leverage is 0.10328893. Ten cases exceed |deleted studentized residual| > 3. Case 1 has leverage 0.10328893 but deleted residual 0.947972.

Interpretation

High leverage is not the same as a large residual. Case 1 illustrates that a record can be unusual in predictor space and influence precision without being a response outlier.

Why it matters

Regression Residual Analysis uses this chart to separate mechanisms. Check coding and source values for high-leverage cases, then examine whether their deletion changes estimates before making any eligibility decision.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 6: Cook’s Distance by Case

Regression Residual Analysis Cook's distance by case
Cook’s distance for each observation with the 4/n screening line. This figure is part of the worked Regression Residual Analysis.
Pattern

Most values are near zero, while a smaller group rises above the review line. The tallest value is visibly larger than the routine cases, but it remains a diagnostic priority rather than proof of invalid data.

Key values

The review line is 4/n = 0.00616333. Exactly 29 observations exceed it, and the maximum Cook’s distance is 0.20287792.

Interpretation

Cook’s distance combines residual magnitude and leverage to summarize joint coefficient influence. Two cases can have similar Cook’s distance for different combinations of outcome surprise and predictor rarity.

Why it matters

The figure matters because the coefficient table should be tested for sensitivity to the most influential verified cases. The primary model should remain intact unless a source or eligibility rule justifies exclusion.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 7: Observed Versus Predicted G3

Regression Residual Analysis observed versus predicted G3
Observed final grades compared with the fitted conditional means. This figure is part of the worked Regression Residual Analysis.
Pattern

Most observations follow the increasing reference direction, especially through the dense middle range. Extreme low outcomes are harder for the linear mean to represent and contribute to the negative residual tail.

Key values

The fitted model explains 85.0563% of sample G3 variation, with adjusted R² = 0.849401 and RMSE = 1.253722. The overall model test is F(5,643) = 731.965860.

Interpretation

Strong calibration in the center can coexist with poor representation of boundary or exceptional outcomes. The plot supports the usefulness of the fitted mean but does not override the residual and variance conflicts.

Why it matters

Regression Residual Analysis places this figure beside residual plots so readers can see both the model’s practical strength and its tail limitations. External validation is still required before future-performance claims.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 8: Standardized Residuals by Case

Regression Residual Analysis standardized residuals by case
Standardized residual sequence across the retained row order. This figure is part of the worked Regression Residual Analysis.
Pattern

Most cases fluctuate near zero, but isolated negative spikes and a smaller number of positive spikes stand out. The sequence does not show an obvious smooth cycle, although row-order interpretation depends on how records were arranged.

Key values

Ten observations exceed the external-studentization rule of |tᵢ| > 3. Durbin–Watson is 1.857347, a value reasonably near two for the retained order.

Interpretation

The chart makes individual extreme errors visible and can reveal clustering in the ordering variable. It cannot establish independence unless the row sequence represents a meaningful temporal or spatial order.

Why it matters

This figure matters for tracing plotted spikes back to original records. Regression Residual Analysis should preserve row identifiers so every extreme point can be verified rather than guessed from its visual position.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 9: Leverage Versus Absolute DFFITS

Regression Residual Analysis leverage versus absolute DFFITS
Design rarity compared with fitted-value influence for every observation. This figure is part of the worked Regression Residual Analysis.
Pattern

The majority of observations lie below both screening references. A smaller group combines high leverage with elevated absolute DFFITS, while some cases cross only one criterion.

Key values

The leverage threshold is 0.01848998. The absolute DFFITS threshold is 0.19230177. There are 47 leverage flags and 29 DFFITS flags; the maximum absolute DFFITS is 1.15073682.

Interpretation

Leverage describes potential to influence, whereas DFFITS records realized change in the focal fitted value under case deletion. A high-leverage point with a small residual may have modest DFFITS.

Why it matters

Regression Residual Analysis uses the joint display to prioritize multi-criterion cases for source review and sensitivity analysis. The two axes should not be collapsed into a single label such as “bad point.”

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

Python Chart 10: Coefficient Confidence Intervals

Regression Residual Analysis coefficient confidence intervals
Conventional OLS estimates and 95% confidence intervals for the five-predictor model. This figure is part of the worked Regression Residual Analysis.
Pattern

G2 has by far the largest positive adjusted slope and a narrow interval that does not cross zero. G1 is also positive. Failures is negative. Studytime crosses zero, while absences has a small positive interval under conventional OLS uncertainty.

Key values

G2: B = 0.885709, 95% CI [0.819088, 0.952329]. G1: B = 0.139457, 95% CI [0.0683, 0.2106]. Failures: B = −0.218290, 95% CI [−0.396711, −0.039870].

Interpretation

These are conditional associations from the declared model, not causal effects. Because both variance tests reject homoscedasticity, the conventional intervals should be compared with HC3 or another justified robust interval.

Why it matters

The chart connects Regression Residual Analysis back to substantive reporting. Diagnostics matter because they can change the uncertainty attached to the slopes even when point estimates and signs remain similar.

Regression Residual Analysis rule: interpret the figure together with the exact fitted model, the relevant numerical test and the case-level audit. A visual flag is a reason to investigate, not an automatic instruction to delete observations.

R Regression Residual Analysis Charts and Explanations

The R figures provide a same-topic visual cross-check using the identical outcome, predictor set and complete-case rule. They are displayed in paired rows, with one explanation box corresponding directly to each graph. Small numerical differences are acceptable only when residual definitions or plotting conventions are explicitly different.

Cross-software finding: Python and R support the same broad conclusion: strong fitted-sample performance, important lower-tail departure, nonconstant spread and a limited set of observations requiring case-level influence review.
R Regression Residual Analysis chart pair 1: mean structure and distribution
R Regression Residual Analysis residuals versus fitted values
R residuals-versus-fitted display for G3 on G1, G2, studytime, failures and absences.
R Regression Residual Analysis normal Q-Q plot
R normal Q–Q comparison for the same residual vector.
Explanation for the chart above

R Chart 1: Residuals Versus Fitted

Pattern: residuals remain broadly centered but do not form a perfectly uniform random band. Key values: R² = 0.850563, RESET p = 0.001759 and both variance-test p-values are below 0.001. Interpretation: the fitted mean is informative, yet curvature and changing variance remain plausible. Why it matters: inspect theory-supported nonlinear terms and robust uncertainty rather than using R² as an assumption check.

R verification: fitted values and residual signs must match the declared equation and the Python case ledger.
Explanation for the chart above

R Chart 2: Normal Q–Q Plot

Pattern: central points align better than the tails, with the strongest departure in the negative tail. Key values: Shapiro–Wilk W = 0.756572, p = 7.722 × 10−30, and maximum |deleted residual| = 7.581732. Interpretation: normal-reference tail behavior is not supported. Why it matters: conventional tail-sensitive inference and individual prediction intervals require caution.

R verification: use the same complete rows and clearly identify whether the plot uses raw, standardized or studentized residuals.
R Regression Residual Analysis chart pair 2: residual shape and variance
R Regression Residual Analysis residual histogram
R histogram of residuals from the five-predictor model.
R Regression Residual Analysis scale-location plot
R scale-location display of residual magnitude across fitted values.
Explanation for the chart above

R Chart 3: Residual Histogram

Pattern: a compact central mass is accompanied by a long negative tail. Key values: RMSE = 1.253722, ten external-studentization flags and Jarque–Bera = 10019.316610. Interpretation: most observations are fitted reasonably, but a small tail contributes disproportionate non-normality. Why it matters: investigate the tail without redefining the sample around the model.

R verification: report the bin choice and preserve the extreme cases rather than truncating the displayed axis.
Explanation for the chart above

R Chart 4: Scale–Location Plot

Pattern: residual magnitude changes across fitted values instead of remaining flat. Key values: Breusch–Pagan = 30.129021, p = 1.391 × 10−5; White = 66.454172, p = 6.832 × 10−7. Interpretation: homoscedastic OLS uncertainty is not well supported. Why it matters: compare HC3 or another justified variance strategy before final interval reporting.

R verification: robust covariance changes standard errors, not the original OLS fitted values or residuals.

Regression Residual Analysis Coefficient Interpretation

The coefficient table defines the equation being diagnosed. Regression Residual Analysis does not replace coefficient interpretation; it determines how cautiously the conventional standard errors, confidence intervals and model form should be reported. Each slope is conditional on the other four included predictors and should not be treated as a causal effect.

Predicted G3 = −0.155190 + 0.139457G1 + 0.885709G2 + 0.096699studytime − 0.218290failures + 0.023367absences
TermBSEtp95% conventional CIWorked interpretation
Intercept−0.1551900.258626−0.60010.5487[−0.6630, 0.3527]Expected G3 at zero on every predictor; this profile may have limited substantive meaning.
G10.1394570.0362273.84950.000130[0.0683, 0.2106]A one-point higher G1 is associated with 0.139 higher fitted G3 when the other predictors are held constant.
G20.8857090.03392726.10665.438 × 10−103[0.8191, 0.9523]G2 is the dominant positive adjusted predictor in the equation.
studytime0.0966990.0618101.56450.1182[−0.0247, 0.2181]The linear one-code increase is not conventionally significant in this specification.
failures−0.2182900.090861−2.40250.0166[−0.3967, −0.0399]Each additional prior failure is associated with a lower fitted G3 after adjustment.
absences0.0233670.0107942.16480.0308[0.0022, 0.0446]The fitted association is small and positive; it should not be interpreted as a beneficial causal effect of absence.

How the Diagnostics Affect Coefficient Reporting

The point estimates above are the OLS solution for the stated equation. Heteroscedasticity does not automatically bias those slopes under the standard exogeneity condition, but it can make homoscedastic standard errors and confidence intervals inappropriate. The significant RESET result also suggests that a coefficient may be averaging a relationship that changes across the predictor range. Therefore, a final report should compare conventional and HC3 uncertainty and should test any nonlinear specification selected from theory rather than from uncontrolled trial and error.

Coefficient stability rule: retain the original coefficient table as the primary prespecified result, then present robust and sensitivity estimates as clearly labeled comparisons. Do not silently replace the model with a cleaned version selected because it produces more attractive p-values.

Predictions, Effects and Worked Residual Calculations

A fitted value is the conditional mean predicted by the five-predictor equation. Regression Residual Analysis begins only after that fitted value is calculated consistently. The worked case below demonstrates why prediction, residual, leverage and influence must be reported as separate quantities.

Worked Prediction for Case 1

TermInputCoefficientContribution
Intercept1−0.155190−0.155190
G100.1394570.000000
G2110.8857099.742799
studytime20.0966990.193398
failures0−0.2182900.000000
absences40.0233670.093468
Predicted G3approximately 9.87447
Residual = observed 11 − predicted 9.8744695 = +1.1255305

The positive residual means the model underpredicted Case 1 by approximately 1.13 grade points. Its externally studentized residual is 0.947972, so it is not a residual outlier under the |t| > 3 rule. Its leverage is 0.103289, far above the 0.018490 review line, and its DFFITS is 0.321733. The case is therefore important because of its unusual predictor profile and influence, not because its observed G3 is extraordinarily far from the fitted value.

Prediction Versus Diagnostic Meaning

Prediction quantities

  • Observed G3: the recorded outcome.
  • Predicted G3: the fitted conditional mean.
  • Raw residual: signed difference in grade points.
  • RMSE: aggregate error scale across all cases.

Diagnostic quantities

  • Studentized residual: case error relative to estimated spread.
  • Leverage: rarity of the predictor combination.
  • Cook’s distance: joint coefficient influence.
  • DFFITS and COVRATIO: fitted-value and precision influence.
Prediction caution: the model is linear and unbounded, whereas grades have a limited observed scale. Predictions near the lower and upper boundaries require special caution, and a model selected or tuned on these data must be evaluated on new observations before generalization claims.

Regression Residual Analysis Assumptions and Diagnostic Decisions

The purpose of this section is to convert diagnostic evidence into explicit decisions. No single statistic can certify a model. Regression Residual Analysis is strongest when the graphical pattern, numerical test, case-level values and proposed remedy all point to the same mechanism.

Diagnostic requirementWorked evidenceStatusDefensible response
Linear conditional meanRESET F = 9.868464, p = 0.001759; residual plot requires reviewPotential issueInvestigate theory-supported nonlinear terms, interactions or splines and validate the alternative.
Constant residual varianceBreusch–Pagan p = 1.391 × 10−5; White p = 6.832 × 10−7Not supportedReport HC3 or another justified robust covariance; consider weighted or explicit variance modeling where appropriate.
Normal-reference residual tailsShapiro–Wilk p = 7.722 × 10−30; Jarque–Bera extremely large; Q–Q tail departureNot supportedUse robust or resampling inference and avoid overconfident individual prediction intervals.
Approximate sequence independenceDurbin–Watson = 1.857347Reasonably near two for current orderVerify whether row order is meaningful and whether clustering or repeated observations exist.
No severe response outliers10 cases with |deleted residual| > 3; maximum = 7.581732Review requiredVerify source records and retain valid observations in the primary analysis.
No influential design cases47 leverage, 29 Cook, 29 DFFITS and 49 COVRATIO flagsReview requiredPrioritize multi-criterion cases and report documented sensitivity refits.

Linearity and Functional Form

The RESET result rejects the simple claim that the five linear predictor terms completely capture the mean structure. This does not identify which variable needs transformation. Partial-residual plots, substantive theory and cross-validated comparison should guide whether to add polynomial, spline or interaction terms. A model should not be expanded until the p-value becomes nonsignificant by repeated searching.

Homoscedasticity

Both variance tests reject constant residual variance. The agreement is stronger evidence than either test alone, but the tests still do not select a remedy. HC3 uncertainty is often a reasonable first sensitivity analysis because it leaves the OLS mean equation unchanged. Weighted least squares is more demanding because weights must represent a defensible variance structure.

Residual Distribution

Residual normality is not required to calculate OLS slopes, and the central limit theorem can make coefficient inference relatively stable in large samples. However, the combination of extreme studentized residuals, a visibly abnormal tail and very strong normality-test results means that the issue should not be dismissed as sample-size sensitivity. Tail predictions and conventional prediction intervals require particular caution.

Independence

Durbin–Watson near two is reassuring only for first-order correlation in the retained order. If students are nested within classrooms or schools, or if records are repeated over time, a clustered or multilevel structure may remain even when Durbin–Watson appears acceptable. Study design takes priority over a single residual statistic.

Influence and Data Integrity

Sixty-six distinct observations cross at least one screening rule. A valid observation can be influential because it represents a rare but real predictor combination. The correct response is to compare the original record with the source, verify coding, and examine whether the central conclusions change in a clearly labeled sensitivity model. Deletion is justified by data quality or eligibility evidence, not by influence alone.

Diagnostic decision: retain the 649-case model as the primary analysis, add robust uncertainty, investigate a limited theory-driven nonlinear specification, verify the most influential records, and present sensitivity findings without replacing the original result.

Regression Residual Analysis in Python, R, SPSS and Excel

Python

Use statsmodels OLS and its influence object to obtain fitted values, residual scales, leverage, Cook’s distance, DFFITS and COVRATIO. Use statsmodels diagnostic functions for RESET, Breusch–Pagan, White, Jarque–Bera and Durbin–Watson.

  • Preserve an explicit case identifier.
  • Export one case-level diagnostic table.
  • State every threshold formula.
  • Plot the exact residual vector used by the tests.

R

Fit the same equation with lm(). Use rstudent(), hatvalues(), cooks.distance(), dffits() and covratio(), together with appropriate diagnostic packages for formal checks.

  • Confirm factor and numeric coding.
  • Retain the intercept.
  • Use identical complete rows.
  • Document any residual-definition differences.

SPSS

Use REGRESSION to fit G3 on the five predictors and save predicted values, residuals, standardized or studentized residuals, leverage and Cook’s distance where available. Preserve the output viewer and case-level saved variables.

  • Verify case order after import.
  • Do not overwrite raw variables.
  • Label saved diagnostic columns.
  • Cross-check coefficient and model tables.

Excel

Use the supplied coefficients to calculate fitted values and raw residuals, then audit threshold formulas and Boolean flags. Excel is especially useful for transparent case-by-case review when the statistical quantities have already been generated correctly.

  • Lock coefficient cells.
  • Use full-precision calculations.
  • Keep one row per original case.
  • Separate data-error notes from statistical flags.
Cross-software rule: Regression Residual Analysis agrees across programs only when the formula, rows, intercept, residual definition, degrees of freedom and threshold formulas agree. Never average conflicting outputs; trace the discrepancy to its computational source.

Code: Expand Only the Software You Need

Python Regression Residual Analysis code
import numpy as np
import pandas as pd
import statsmodels.api as sm
from statsmodels.stats.diagnostic import (
    linear_reset, het_breuschpagan, het_white
)
from statsmodels.stats.stattools import durbin_watson, jarque_bera
from scipy.stats import shapiro

predictors = ["G1", "G2", "studytime", "failures", "absences"]
work = data[["G3", *predictors]].dropna().copy()

X = sm.add_constant(work[predictors], has_constant="add")
fit = sm.OLS(work["G3"], X).fit()
infl = fit.get_influence()
frame = infl.summary_frame()

audit = work.reset_index(names="source_index")
audit["fitted"] = fit.fittedvalues.to_numpy()
audit["residual"] = fit.resid.to_numpy()
audit["studentized_deleted"] = infl.resid_studentized_external
audit["leverage"] = infl.hat_matrix_diag
audit["cooks_d"] = infl.cooks_distance[0]
audit["dffits"] = infl.dffits[0]
audit["covratio"] = infl.cov_ratio

n = len(audit)
p = X.shape[1]
audit["flag_studentized"] = audit["studentized_deleted"].abs() > 3
audit["flag_leverage"] = audit["leverage"] > 2 * p / n
audit["flag_cook"] = audit["cooks_d"] > 4 / n
audit["flag_dffits"] = audit["dffits"].abs() > 2 * np.sqrt(p / n)
audit["flag_covratio"] = (
    (audit["covratio"] < 1 - 3 * p / n) |
    (audit["covratio"] > 1 + 3 * p / n)
)
flag_cols = [c for c in audit if c.startswith("flag_")]
audit["flag_any"] = audit[flag_cols].any(axis=1)

reset = linear_reset(fit, power=2, use_f=True)
bp = het_breuschpagan(fit.resid, fit.model.exog)
white = het_white(fit.resid, fit.model.exog)
dw = durbin_watson(fit.resid)
jb = jarque_bera(fit.resid)
sw = shapiro(fit.resid)

Keep preprocessing and case identifiers explicit. The exact field names returned by an influence summary may differ by statsmodels version, so verify each column before publication.

R Regression Residual Analysis code
vars <- c("G3", "G1", "G2", "studytime", "failures", "absences")
work <- na.omit(data[vars])
fit <- lm(G3 ~ G1 + G2 + studytime + failures + absences, data = work)

n <- nrow(work)
p <- length(coef(fit))

audit <- transform(
  work,
  fitted = fitted(fit),
  residual = resid(fit),
  studentized_deleted = rstudent(fit),
  leverage = hatvalues(fit),
  cooks_d = cooks.distance(fit),
  dffits = dffits(fit),
  covratio = covratio(fit)
)

audit$flag_studentized <- abs(audit$studentized_deleted) > 3
audit$flag_leverage <- audit$leverage > 2 * p / n
audit$flag_cook <- audit$cooks_d > 4 / n
audit$flag_dffits <- abs(audit$dffits) > 2 * sqrt(p / n)
audit$flag_covratio <- audit$covratio < (1 - 3*p/n) |
                       audit$covratio > (1 + 3*p/n)

plot(fit, which = 1)
qqnorm(resid(fit)); qqline(resid(fit))
hist(resid(fit), main = "Residual histogram", xlab = "Residual")

Additional packages can provide RESET and heteroscedasticity tests. Record package versions and do not assume that identically named residuals are calculated with identical small-sample conventions.

SPSS Regression Residual Analysis syntax
REGRESSION
  /DEPENDENT G3
  /METHOD=ENTER G1 G2 studytime failures absences
  /STATISTICS COEFF OUTS R ANOVA CI(95)
  /RESIDUALS DURBIN HISTOGRAM(ZRESID) NORMPROB(ZRESID)
  /CASEWISE PLOT(ZRESID) OUTLIERS(3)
  /SAVE PRED RESID ZRESID SRESID LEVER COOK.

Saved-variable names can vary. Inspect the active dataset after execution, retain the original case identifier and export the output viewer as the audit record.

Excel formulas for fitted values and flags
Predicted G3:
=$B$2+$B$3*[@G1]+$B$4*[@G2]+$B$5*[@studytime]
+$B$6*[@failures]+$B$7*[@absences]

Raw residual:
=[@G3]-[@[Predicted G3]]

Studentized flag:
=ABS([@[Deleted Studentized Residual]])>3

Leverage flag:
=[@Leverage]>(2*6/649)

Cook flag:
=[@[Cook Distance]]>(4/649)

DFFITS flag:
=ABS([@DFFITS])>(2*SQRT(6/649))

COVRATIO flag:
=OR([@COVRATIO]<(1-3*6/649),[@COVRATIO]>(1+3*6/649))

Any flag:
=OR([@[Studentized Flag]],[@[Leverage Flag]],[@[Cook Flag]],
    [@[DFFITS Flag]],[@[COVRATIO Flag]])

Use full-precision diagnostic values in hidden or calculation columns and format the visible cells separately. Rounding before applying thresholds can change borderline flags.

26 Advanced Regression Residual Analysis Topics

These expandable panels extend the worked analysis from basic residual interpretation to robust inference, model revision, validation and reproducible case review. Open only the topics needed for the current reporting decision.

1. Regression Residual Analysis: Raw Residuals and Sign Direction

A raw residual is observed G3 minus fitted G3. Positive values indicate underprediction and negative values indicate overprediction. The residual retains the outcome unit, making it easy to explain but difficult to compare across observations with different leverage.

In an OLS model with an intercept, residuals sum to approximately zero and are orthogonal to the included predictor columns. Those algebraic facts do not prove that the residual pattern is random or that the model is correctly specified.

Decision rule: Keep one sign convention in every table, plot and sentence. Recalculate several rows directly from observed and fitted values before interpreting any residual chart.

Caution: Do not call a negative residual a negative outcome effect; it is simply an overprediction under the fitted equation.

2. Regression Residual Analysis: Internally Standardized Versus Externally Studentized Residuals

Internally standardized residuals use the model’s overall residual spread, including the focal case. Externally studentized residuals estimate the spread after deleting that case. The deleted version can reveal a severe outlier that partially masks itself by inflating the full-sample error estimate.

The worked Regression Residual Analysis uses |externally studentized residual| > 3 as a review rule. Ten cases cross it, and the maximum absolute value is 7.581732.

Decision rule: Use the externally studentized scale for formal case screening, label it correctly, and preserve the raw residual for interpretation in G3 units.

Caution: A threshold crossing requests verification; it does not establish fabrication, miscoding or exclusion eligibility.

3. Regression Residual Analysis: The Hat Matrix and Leverage

The hat matrix H maps observed outcomes to fitted values. Its diagonal hᵢᵢ measures how far a predictor profile lies from the center of the design space. Leverage depends on X, not on the observed G3 value.

With p = 6 fitted coefficients and n = 649, the worked review line is 2p/n = 0.01848998. Forty-seven observations exceed it, and the maximum is 0.10328893.

Decision rule: Review high-leverage rows for coding, valid rare combinations and extrapolation risk. Combine leverage with residual and influence evidence before prioritizing action.

Caution: Leverage is not an error measure. A perfectly recorded case can have high leverage because it represents a rare but valid predictor profile.

4. Regression Residual Analysis: Cook’s Distance

Cook’s distance summarizes the joint effect of deleting one case on the fitted coefficient vector. It increases when residual magnitude, leverage or both are substantial. The conventional 4/n line equals 0.00616333 in this analysis.

Twenty-nine cases exceed the line and the maximum Cook’s distance is 0.20287792. The line is intentionally sensitive in a large sample and should be treated as a screen.

Decision rule: Rank cases by Cook’s distance, verify their source values and compare the complete model with a clearly labeled sensitivity fit for the most influential valid cases.

Caution: Do not delete all observations above 4/n. That practice can remove a legitimate part of the population and manufacture apparent assumption compliance.

5. Regression Residual Analysis: DFFITS

DFFITS measures the standardized change in an observation’s fitted value when that observation is deleted. It therefore focuses on prediction at the focal design point rather than the complete coefficient vector.

The worked threshold is 2√(p/n) = 0.19230177. Twenty-nine cases exceed it and the maximum absolute DFFITS is 1.15073682.

Decision rule: Read DFFITS with leverage and Cook’s distance. Prioritize cases that cross several measures because they provide the clearest sensitivity targets.

Caution: DFFITS and Cook’s distance are related but not interchangeable; report the quantity that matches the influence question.

6. Regression Residual Analysis: DFBETAS for Individual Slopes

DFBETAS quantify how much each coefficient changes, in standard-error units, when a case is omitted. They answer which specific slope is sensitive, whereas Cook’s distance summarizes joint influence.

A case can have moderate Cook’s distance yet strongly affect one coefficient if its predictor profile aligns with that term. DFBETAS are especially valuable when the research conclusion focuses on G2, failures or another named predictor.

Decision rule: Calculate and inspect coefficient-specific DFBETAS when sensitivity of a particular substantive slope matters. Report which coefficients change rather than using one generic influence label.

Caution: Because no verified DFBETAS table was supplied in the attached results, do not invent case counts or maxima for this measure.

7. Regression Residual Analysis: COVRATIO

COVRATIO compares the determinant of the coefficient covariance matrix with and without a case. Values below one can indicate reduced precision after deletion; values above one can indicate increased precision, depending on the design and residual contribution.

The worked interval is 0.97226502 to 1.02773498, and 49 cases lie outside it. This is the largest individual flag count in the supplied analysis.

Decision rule: Use COVRATIO as a precision-focused complement to residual, leverage and fitted-value influence measures. Verify the parameter count used to form the bounds.

Caution: A COVRATIO flag does not necessarily imply a large change in prediction or coefficient direction.

8. Regression Residual Analysis: PRESS Residuals and Leave-One-Out Prediction

A PRESS residual predicts each observation from a model fitted without that observation. It is closely related to leverage-adjusted residuals and provides a leave-one-out view of prediction error. PRESS can reveal optimistic fitted-sample performance that ordinary residuals conceal.

The current article reports fitted RMSE and case-deletion diagnostics but does not claim a verified PRESS statistic. A future prediction-focused extension should calculate PRESS or nested cross-validation without changing the primary diagnostic findings.

Decision rule: Keep fitted-sample Regression Residual Analysis separate from held-out performance evaluation. Label PRESS, cross-validated RMSE and training RMSE distinctly.

Caution: Do not describe R² = 0.850563 as future predictive accuracy.

9. Regression Residual Analysis: Residuals Versus Fitted Values

This graph is the broad first check for curvature, changing spread and unusual errors. A smooth curve around zero suggests missing nonlinear mean structure. A funnel suggests heteroscedasticity. Integer-valued outcomes can produce bands without automatically violating the model.

In the worked analysis, the plot is interpreted with RESET p = 0.001759 and two highly significant variance tests.

Decision rule: Use the plot to formulate a specific hypothesis, then evaluate a theory-supported alternative with formal comparison and validation.

Caution: Do not fit a complicated curve solely because a smoother is not perfectly horizontal in a large sample.

10. Regression Residual Analysis: Normal Q–Q Plot and Residual Histogram

The Q–Q plot emphasizes quantile departure, while the histogram emphasizes overall shape. They are complementary because a histogram can hide tail behavior through bin choice and a Q–Q plot can make the center appear satisfactory while extremes depart sharply.

Shapiro–Wilk W = 0.756572 and Jarque–Bera = 10019.316610 agree with the strong lower-tail pattern.

Decision rule: Report visual and numerical evidence together. Use robust or resampling inference when tail departure is materially relevant.

Caution: Normality tests become highly sensitive as n grows; interpret effect size, tail severity and inferential purpose, not p-values alone.

11. Regression Residual Analysis: Scale–Location Plot

The scale–location graph usually plots √|standardized residual| against fitted values. Removing the residual sign prevents positive and negative errors from canceling visually and makes variance trends easier to detect.

The worked plot is supported by Breusch–Pagan p = 1.391 × 10⁻⁵ and White p = 6.832 × 10⁻⁷.

Decision rule: Describe the direction and location of changing spread, then select a variance remedy whose assumptions can be justified.

Caution: A scale-location trend identifies a variance problem; it does not estimate correct weights by itself.

12. Regression Residual Analysis: Ramsey RESET Specification Test

RESET adds powers or functions of the fitted values to test whether the original linear predictor may omit nonlinear structure. The worked F statistic is 9.868464 with p = 0.001759.

A significant result indicates misspecification risk but does not identify the omitted variable, interaction or transformation. It can also react to heteroscedasticity or other departures.

Decision rule: Use theory, partial-residual plots and validated alternatives to identify the form of any revision. Keep the original model visible as the prespecified benchmark.

Caution: Do not add arbitrary polynomial terms until RESET becomes nonsignificant.

13. Regression Residual Analysis: Breusch–Pagan Test

The Breusch–Pagan test examines whether squared residual variation is associated with the supplied design. The statistic is 30.129021 with p = 1.391 × 10⁻⁵, providing evidence against constant variance.

The test is most interpretable when the auxiliary variance relationship is plausibly linear in the predictors.

Decision rule: Use the result with the scale-location plot and compare heteroscedasticity-consistent uncertainty before final reporting.

Caution: A significant Breusch–Pagan test does not mean the OLS point estimates should automatically be discarded.

14. Regression Residual Analysis: White Test

The White test allows a broader auxiliary variance pattern, often including squares and cross-products of regressors. The worked statistic is 66.454172 with p = 6.832 × 10⁻⁷.

Agreement with Breusch–Pagan strengthens the conclusion that residual variance is not constant, although the White test can consume many degrees of freedom in smaller datasets.

Decision rule: Report both tests as complementary evidence and distinguish a variance correction from a change in the conditional-mean equation.

Caution: Do not infer the exact variance function from the White test alone.

15. Regression Residual Analysis: Durbin–Watson and Observation Order

Durbin–Watson = 1.857347 is reasonably close to two for the retained row order. It primarily targets first-order residual autocorrelation and is meaningful only when adjacent rows represent a relevant sequence.

Cross-sectional educational data may be clustered by school or classroom even when arbitrary file order produces an acceptable Durbin–Watson value.

Decision rule: State the ordering or grouping structure. Use cluster-robust, generalized estimating equation or multilevel methods when the design requires them.

Caution: Do not write that independence is proven because Durbin–Watson is near two.

16. Regression Residual Analysis: Bounded Outcomes, Floor Effects and Ceiling Effects

G3 has a bounded practical range, while a linear model can predict any real number. Near a lower or upper boundary, residual variance can compress and the conditional mean can become nonlinear. A cluster of zero grades can create a pronounced negative tail when predictor histories imply higher expected performance.

Decision rule: Inspect predictions near boundaries and compare a scientifically suitable alternative when boundary behavior affects the research claim.

Caution: Do not choose a new model solely to remove difficult observations; the alternative must match the outcome scale and estimand.

17. Regression Residual Analysis: Heteroscedasticity-Consistent Standard Errors

HC0 through HC3 covariance estimators leave OLS coefficients and fitted values unchanged but adjust coefficient uncertainty for nonconstant variance. HC3 gives stronger leverage correction and is often preferred for finite-sample sensitivity reporting.

The attached results establish heteroscedasticity but do not provide verified HC3 intervals, so this article recommends the comparison without inventing numerical robust results.

Decision rule: Present conventional and HC3 results side by side, state that coefficients are unchanged, and explain any inferential differences.

Caution: Robust standard errors do not repair nonlinearity, omitted variables, clustering or extreme prediction error.

18. Regression Residual Analysis: Weighted Least Squares

Weighted least squares changes the estimation criterion so observations with larger modeled variance receive less weight. It can improve efficiency when a defensible variance function is known or estimated reliably.

Unlike robust covariance, WLS changes coefficients, fitted values and residuals. A complete Regression Residual Analysis must therefore be rerun for the weighted model.

Decision rule: Use WLS only when weights have a substantive or empirically validated interpretation and report how they were obtained.

Caution: Data-dependent weights can overfit the same residual pattern they are intended to correct.

19. Regression Residual Analysis: Transformations, Polynomials, Interactions and Splines

The significant RESET result motivates a structured search for mean-form improvements. Transformations may linearize a relationship; polynomial terms represent smooth curvature; interactions allow one predictor’s association to vary with another; splines provide flexible local shape.

Decision rule: Choose candidate terms from theory and exploratory evidence, compare them under cross-validation or a prespecified criterion, and retain interpretability.

Caution: Repeatedly testing many forms until diagnostics look favorable inflates researcher degrees of freedom.

20. Regression Residual Analysis: Robust Regression

Robust regression changes the loss function so extreme residuals have less influence. It can reveal whether the central coefficient pattern persists when tail observations receive reduced weight.

Robust regression estimates a different fitted solution from OLS and should be presented as a sensitivity or alternative estimand, not as a hidden cleanup step.

Decision rule: Compare OLS and robust-regression coefficients, identify which conclusions remain stable, and keep the full-data OLS benchmark visible.

Caution: Downweighting a valid rare subgroup can conceal meaningful heterogeneity.

21. Regression Residual Analysis: Clustered and Multilevel Residual Structure

Observations nested within classrooms, schools, families or repeated students can share unmodeled variation. Ordinary residual plots may look acceptable while standard errors remain too small because independence is violated at the cluster level.

Decision rule: Use study-design information to decide whether cluster-robust, generalized estimating equation or multilevel modeling is required. Examine residuals at each relevant level.

Caution: Durbin–Watson does not diagnose arbitrary cluster dependence.

22. Regression Residual Analysis: Large Samples, Multiple Tests and Practical Importance

With 649 observations, small departures can become statistically detectable. At the same time, the very large Jarque–Bera value, ten extreme studentized residuals and agreement between two heteroscedasticity tests indicate that the current concerns are not based on one marginal p-value.

Decision rule: Interpret test statistics, plots, effect on conclusions and practical consequences together. Predefine the diagnostic family where possible.

Caution: Do not treat every p < .05 as requiring a different model, and do not dismiss every significant result as mere sample-size sensitivity.

23. Regression Residual Analysis: Case Deletion and Sensitivity Analysis

A sensitivity analysis asks whether conclusions change under a documented alternative, such as correcting a confirmed data error or temporarily omitting a small set of the most influential verified observations. It is not a license to select the cleanest result.

The primary model in this article retains all 649 complete cases. The 66 flagged observations form a review list, not a deletion list.

Decision rule: State the eligibility reason for every changed row, report the original and sensitivity results, and explain which conclusion is robust.

Caution: Never remove all flagged cases as a single automatic batch.

24. Regression Residual Analysis: Cross-Validation and External Validation

Residual diagnostics evaluate the fitted model on the analyzed sample. Cross-validation and external validation evaluate performance on observations not used to estimate the same coefficients. A model can have attractive residual plots yet generalize poorly, or have imperfect residual normality while predicting well.

Decision rule: Report training RMSE separately from validation RMSE and repeat all preprocessing inside each training fold.

Caution: Do not use the current fitted R² or RMSE as evidence of out-of-sample performance.

25. Regression Residual Analysis: Python, R, SPSS and Excel Reconciliation

Software can differ in definitions of standardized residuals, deleted residuals, leverage-adjusted scales, case indexing and small-sample test formulas. Agreement requires matching the equation, rows, intercept, precision and definitions.

Decision rule: Build one reconciliation table containing n, p, coefficients, fitted values for selected rows, residual sign, thresholds and flag counts. Trace every discrepancy.

Caution: Do not average conflicting outputs or assume one program is correct because it is more familiar.

26. Regression Residual Analysis: Audit Trail and Reproducible Reporting

A publishable Regression Residual Analysis should preserve the raw-data identifier, analysis formula, missing-data rule, software version, coefficient table, case-level diagnostic ledger, threshold formulas, plots, formal tests and every sensitivity decision. This record protects against selective interpretation and makes future correction possible.

Decision rule: Archive the complete primary analysis before any remedy, then save each alternative with a descriptive name and a written reason for the change.

Caution: Do not overwrite the original output with a revised model or cleaned dataset.

APA-Style Reporting for Regression Residual Analysis

A multiple linear regression predicted G3 from G1, G2, studytime, failures and absences using 649 complete observations. The model was statistically significant, F(5, 643) = 731.97, p < .001, and explained 85.06% of the fitted-sample variance in G3, R2 = .851, adjusted R2 = .849, RMSE = 1.254. G2 was the strongest positive adjusted predictor, B = 0.886, 95% CI [0.819, 0.952], p < .001; G1 was also positive, B = 0.139, 95% CI [0.068, 0.211], p < .001; and failures was negative, B = −0.218, 95% CI [−0.397, −0.040], p = .017.

Regression Residual Analysis identified possible functional-form error, RESET F = 9.87, p = .002, and heteroscedasticity by both Breusch–Pagan, statistic = 30.13, p < .001, and White, statistic = 66.45, p < .001, tests. Residual normality was not supported, Shapiro–Wilk W = .757, p < .001, and ten observations exceeded |externally studentized residual| > 3. Forty-seven observations crossed the leverage screen, 29 crossed Cook’s-distance and DFFITS screens, 49 crossed the COVRATIO band, and 66 unique observations met at least one review criterion. These observations were treated as diagnostic review cases rather than automatically excluded. Robust uncertainty, theory-guided functional-form assessment and documented sensitivity analysis were recommended.

Reporting note: the APA paragraph describes conventional OLS intervals because verified robust intervals were not supplied. Add HC3 values only after calculating and checking them from the same 649-row equation.

Regression Residual Analysis Publication Checklist

Model and data

  • State the exact formula and intercept convention.
  • Name G3 as the outcome and all five predictors.
  • Report N = 649 and the complete-case rule.
  • Preserve a stable case identifier.
  • Report R², adjusted R², F, p and RMSE.
  • Provide the complete coefficient table with units.
  • Distinguish fitted-sample and validation performance.
  • Describe study design and possible clustering.

Diagnostics and decisions

  • Define raw residual sign.
  • Identify standardized versus externally studentized residuals.
  • Show the formula for every screening threshold.
  • Report flag counts and the 66-case union correctly.
  • Link each chart to exact numerical evidence.
  • Do not label flags as invalid data.
  • Report robust or sensitivity analyses separately.
  • Archive the original full-data result.
Final quality check: confirm that the Table of Contents targets work, every image URL is unique and topic-relevant, all internal links remain on onlineinternetcafe.com, and no unsupported download link has been added.

Downloads and Regression Residual Analysis Chart Resources

Direct Internal Chart Files

Frequently Asked Questions About Regression Residual Analysis

1. What is Regression Residual Analysis?

Regression Residual Analysis is the structured examination of observed-minus-predicted errors, residual assumptions and case influence after a regression model is fitted. It connects plots, formal tests and case-level evidence to a documented modeling decision.

2. What is the formula for a raw residual?

The raw residual for case i is eᵢ = yᵢ − ŷᵢ. In this post, yᵢ is observed G3 and ŷᵢ is the value predicted from G1, G2, studytime, failures and absences.

3. What does a positive or negative residual mean?

A positive residual means observed G3 is above the fitted value, so the model underpredicted that case. A negative residual means the fitted value is above observed G3, so the model overpredicted it.

4. What is the difference between standardized and studentized residuals?

Both scale residuals by estimated spread and leverage. An externally studentized residual uses an error estimate calculated with the focal case deleted, which makes it particularly useful for detecting observations that mask their own extremeness.

5. Does |studentized residual| greater than 3 prove bad data?

No. It is a screening convention. The ten flagged observations require source verification and substantive review, but they remain valid unless an eligibility or data-quality rule shows otherwise.

6. What is leverage in Regression Residual Analysis?

Leverage measures how unusual a case’s predictor combination is. It depends on the design matrix rather than the observed outcome. The worked line is 0.01848998, 47 cases exceed it and the maximum is 0.10328893.

7. What does Cook’s distance measure?

Cook’s distance combines residual size and leverage to summarize how deleting a case affects the fitted coefficient vector. Twenty-nine cases exceed 4/n = 0.00616333 in the worked model.

8. What does DFFITS measure?

DFFITS measures the standardized change in a case’s fitted value when that case is omitted. The worked absolute threshold is 0.19230177, with 29 cases flagged and a maximum absolute value of 1.15073682.

9. What does COVRATIO measure?

COVRATIO describes how deleting a case changes the determinant of the coefficient covariance matrix. Forty-nine observations fall outside the worked band from 0.97226502 to 1.02773498.

10. Why are there 66 unique flags when the category counts total more?

The flag categories overlap. One observation can exceed leverage, Cook’s distance, DFFITS and COVRATIO rules simultaneously. Sixty-six is the union of distinct cases with at least one flag.

11. Must residuals be perfectly normal?

No. Perfect normality is not required to compute OLS coefficients. Normal-reference behavior matters more for conventional small-sample inference and prediction intervals. The severe tail evidence here still warrants robust or resampling checks.

12. Why use both Breusch–Pagan and White tests?

They examine nonconstant variance under different auxiliary structures. Both reject homoscedasticity in this model, strengthening the warning, but neither identifies the correct variance remedy by itself.

13. Does Durbin–Watson = 1.857347 prove independence?

No. It is reasonably close to two for the retained order, but independence depends on data collection, clustering and meaningful sequence. Classroom, school or repeated-measure dependence requires design-specific methods.

14. Do robust standard errors fix the model?

No. HC3 or another robust covariance can improve uncertainty estimates under heteroscedasticity, but it does not change the fitted mean, repair nonlinear form, correct data errors or model clustering.

15. What does the significant Ramsey RESET result mean?

RESET F = 9.868464, p = 0.001759 indicates that the additive linear mean structure may omit nonlinear information. It does not specify which term to add; theory and validated model comparison must guide revision.

16. Which Regression Residual Analysis charts should be reported?

At minimum, report residuals versus fitted, a Q–Q or distribution plot, a scale-location or variance display, and an influence plot. This worked post adds observed-versus-predicted, case-sequence, DFFITS and coefficient-interval figures for a complete audit.

Regression Residual Analysis Conclusion

Regression Residual Analysis changes the interpretation of this five-predictor grade model without erasing its strengths. The equation explains approximately 85.06% of fitted-sample G3 variation and has RMSE = 1.253722, so G1, G2, studytime, failures and absences provide a highly informative conditional mean. G2 is the dominant positive predictor, G1 is also positive, and failures has a negative adjusted association.

The remaining evidence prevents an unqualified “assumptions satisfied” conclusion. RESET indicates potential functional-form error, both Breusch–Pagan and White tests identify heteroscedasticity, normality checks show severe tail departure, and 66 distinct cases meet at least one residual, leverage or influence screen. Durbin–Watson is reasonably near two for the retained order, but study-design independence must still be verified.

The correct next step is not to delete all flagged observations or abandon regression. Retain the full 649-case result as the primary analysis, verify the most influential source records, calculate robust uncertainty, investigate a limited theory-supported nonlinear specification, and report sensitivity findings transparently. That approach uses Regression Residual Analysis as a scientific quality-control process rather than a cosmetic search for perfect plots.

Final answer: the fitted model is useful, but conventional uncertainty and tail prediction should be qualified. The defensible published conclusion combines the strong average fit with the documented specification, variance, distribution and influence concerns.

Back to top

Need help applying this to your own data?

Salar Cafe can help interpret output, clean datasets, review assumptions, build dashboards and explain statistical results ethically.

Need help interpreting your data analysis results?

Contact Salar Cafe
Engr. Muhammad Yar Saqib author profile photo

Engr. Muhammad Yar Saqib

Engr. Muhammad Yar Saqib is an electrical engineer educated at the University of Bradford, United Kingdom, a writer and poet, and an Assistant Education Officer in the School Education Department, Punjab, serving since July 2017. He writes practical guides on statistics, SPSS, data analysis, mathematics and educational technology, with an emphasis on transparent methods, reproducible calculations and ethical learning support.