Regression diagnostics help you discover why a model with an impressive R² can still produce unstable coefficients, misleading tests, or unreliable conclusions. This guide works through 12 exercises on multicollinearity, heteroscedasticity, autocorrelation, and measurement error. Along the way, you will learn how to calculate each result, choose a correction, and recognize when a textbook shortcut goes too far.
For example, one household model explains more than 99% of the variation in consumption, yet it cannot separate income from wealth reliably. Another example produces a higher R² after replacing an accurately measured variable with a noisy one. Therefore, a good fit should start your investigation rather than end it.
What regression diagnostics actually diagnose
A regression equation describes a conditional relationship between an outcome and explanatory variables. However, different problems affect different parts of the analysis. Collinearity concerns the information in the predictors; heteroscedasticity concerns the variance of the errors; autocorrelation concerns dependence across observations; measurement error concerns the quality of the recorded variables.
| Problem | Main warning sign | What can go wrong | Useful response |
|---|---|---|---|
| Perfect multicollinearity | One predictor exactly equals a combination of others | No unique unrestricted coefficient vector | Remove redundant terms or impose a justified restriction |
| High multicollinearity | Predictors carry nearly the same information | Large standard errors and unstable individual coefficients | Inspect VIFs, collect informative data, or use theory |
| Heteroscedasticity | Error variance changes across observations | Conventional standard errors can mislead | Robust covariance or justified WLS |
| Autocorrelation | Errors persist over time | Conventional inference can fail; dynamic misspecification may remain | Inspect residuals, consider HAC or a dynamic model |
| Measurement error in X | Recorded predictor differs from its target | OLS may estimate the wrong slope even in large samples | Validation data, an explicit error model, or valid instruments |
Bias, precision, and fit are different questions
Under the appropriate zero-conditional-mean assumption, heteroscedasticity alone does not bias OLS coefficients. Nevertheless, it changes their variance and undermines the usual homoscedastic standard errors. Similarly, serial correlation does not automatically imply coefficient bias under strict exogeneity, although it often appears alongside omitted dynamics that do create bias.
By contrast, classical measurement error in an explanatory variable generally creates endogeneity. High multicollinearity introduces a different problem: the data may predict the outcome well while providing little information about separate slopes. As a result, no single diagnostic can certify the entire model.
Read the units before reading the coefficients
The family and firm tables use thousands of dollars, while the historical macroeconomic and inventory tables use billions. Throughout this article, calculations retain the numerical units shown in those tables. Consequently, an intercept of 21.637 in the firm example means approximately $21,637, not 21,637 thousand dollars.
Also, the interest-rate variable uses percentage points. A change from 5 to 6 is a one-percentage-point increase; it is not a 1% proportional increase. Keeping that distinction explicit prevents a common interpretation error.
Regression diagnostics for multicollinearity: exercises 1–3
Exercise 1: identify an exact linear dependency
Consider a consumption model that includes current disposable income, last period’s disposable income, and the change in disposable income. The supplied exercise 9.16 uses all three terms. However, the change already equals current income minus lagged income.
ΔYdt = Ydt − Yd,t−1
First, substitute the second expression into the first. Next, combine the coefficients on the two distinct income variables.
Only two combinations of the three income coefficients affect fitted consumption. Therefore, infinitely many triples generate the same fitted values. For any number a, replacing the three slopes with β₁ − a, β₂ + a, and β₃ + a leaves the prediction unchanged.
Solution: remove one redundant regressor or supply an economically justified restriction. For example, estimate current and lagged income without the change term. Standardizing the predictors cannot fix this exact identity, and collecting more observations with the same identity cannot fix it either.
Exercise 2: explain a high R² with weak individual t-statistics
The next example uses hypothetical consumption C, disposable income Yd, and wealth W for 15 families. First, estimate consumption on both predictors. Recalculation from the visible table gives the following equation.
R² = 0.994290; adjusted R² = 0.993339
| Model | Intercept | Income slope | Wealth slope | R² |
|---|---|---|---|---|
| Income and wealth | 1.54174 | 1.40731 | −0.145742 | 0.994290 |
| Income only | 2.12675 | 0.803865 | — | 0.993960 |
| Wealth only | 2.92385 | — | 0.193946 | 0.992494 |
The joint model has an income t-statistic of about 1.943 and a wealth t-statistic of −0.834. In contrast, the income-only t-statistic is approximately 46.252. Adding wealth therefore contributes very little fit while making the separate income estimate far less precise.
A negative wealth coefficient does not establish that wealth reduces consumption. Instead, it describes the estimated relationship holding income fixed in a sample with almost no independent variation between those predictors. Such a comparison has weak support in these data.
The Penn State explanation of variance inflation factors provides the relevant diagnostic: regress each predictor on the others and calculate VIF from that auxiliary R². With exactly two predictors and an intercept, the calculation reduces to their squared correlation.
r(Yd, W) = 0.999705 → VIF ≈ 1,695.43
For perspective, the square root of 1,695.43 is about 41.18. Under the standard variance formula, this is the standard-error inflation relative to an otherwise comparable orthogonal-predictor design with the same error variance and predictor variation. However, it is not the actual ratio of standard errors from the two fitted models, because their estimated error variances also differ.
Exercise 3: impose a defensible coefficient restriction
Suppose economic reasoning supports β₂ = 0.25β₁ in the consumption equation. Then the two-predictor model collapses into one composite predictor. This is the restriction in supplied exercise 9.18.
C = β0 + β1Z + u
Using all 15 observations produces the fitted relationship below. Consequently, the original income and wealth coefficients follow directly from the restriction.
β̂income = 0.394846
β̂wealth = 0.25 × 0.394846 = 0.0987115
R² = 0.993360
The restricted model retains almost all the explanatory power of the unrestricted model. Nevertheless, the restriction supplies information that the sample itself cannot provide reliably. An incorrect restriction can create misleading precision, so you should explain its substantive basis before adopting it.
Practical lesson: combining income and wealth here changes the question to the effect of a specified income–wealth index. It does not reveal two independently identified economic effects. Therefore, present the restriction beside the coefficients rather than hiding it in a footnote.
Regression diagnostics for heteroscedasticity: exercises 4–7
Exercise 4: calculate a Goldfeld–Quandt test
The first firm dataset contains 35 observations of capital formation Y and sales X. Each of five sales levels has seven firms. To investigate increasing error variance, sort by sales, keep the first 14 and last 14 observations, and omit the middle seven.
Next, fit a separate intercept-and-slope regression in each retained group. The full-sample equation and the two subgroup equations are:
Low-sales group: Ŷ = 27.42857 + 0.0331429X
High-sales group: Ŷ = 15.02857 + 0.103714X
| Group | Observations | Parameters | Residual df | Residual sum of squares |
|---|---|---|---|---|
| Low sales | 14 | 2 | 12 | 4.897143 |
| High sales | 14 | 2 | 12 | 34.694286 |
Here, RSS means residual sum of squares. Some textbooks use ESS for error sum of squares, while others use ESS for explained sum of squares. Therefore, define the abbreviation before comparing outputs.
F = (34.694286 ÷ 12) ÷ (4.897143 ÷ 12) = 7.08460
Under the classical normal-error, independent-observation, correctly specified model assumptions, compare this ratio with an F distribution with 12 and 12 degrees of freedom. The one-sided 5% critical value is approximately 2.68664, and the p-value is about 0.000948. Thus, the equal-variance null fails this test.
The statsmodels Goldfeld–Quandt documentation describes the two-subsample test and its sorting, splitting, and directional options. In practice, state which variable determines the ordering and whether your alternative assumes increasing variance.
Also, the two group slopes differ substantially. That pattern suggests checking the mean function as well as the error variance. A variance test cannot establish that a single straight line captures the relationship correctly.
Exercise 5: use weighted least squares when variance follows X²
Now assume Var(ui | Xi) = σ²Xi² and X is nonzero. Dividing the entire equation by X makes the transformed error variance constant under this assumption. As a result, OLS on the transformed equation corresponds to weighted least squares with weights 1/X².
wi = 1/Xi²
Notice the coefficient positions: the transformed intercept is the original slope. Conversely, the coefficient on 1/X is the original intercept. Recalculation gives:
Original-unit representation: Ŷ = 23.18710 + 0.0703853X
For example, the weight of a firm with sales of 100 is nine times the weight of a firm with sales of 300. That follows from (300/100)² = 9. However, this relative weighting makes sense only if the assumed variance relationship is reasonable.
The NIST guide to weighted least squares explains why inverse-variance weighting can improve precision and why uncertain weights require care. Therefore, inspect the transformed residuals and consider sensitivity to alternative variance models.
The transformed R² is approximately 0.98177. Nevertheless, it describes variation in Y/X, not variation in Y. Comparing it directly with the original R² of 0.93616 would mix different dependent variables and different fitting objectives.
Exercise 6: test changing variance in a multiple regression
The second firm dataset adds a productivity index X₂ to sales X₁. First, estimate the full model using 35 observations. Then sort by productivity and form groups of 14 observations at each end, again omitting seven observations.
R² = 0.991595
| Productivity group | RSS | Residual df |
|---|---|---|
| Lowest 14 | 0.658157 | 11 |
| Highest 14 | 2.126477 | 11 |
F0.95;11,11 = 2.81793; p ≈ 0.03203
This time, 11 degrees of freedom is correct because each subgroup model estimates three parameters. Consequently, the classical test rejects equal variance at 5%, but not at 1%. The result is more marginal than the first firm example, so avoid treating both findings as equally strong.
The lowest-productivity regression has a negative productivity slope, whereas the highest-productivity regression has a positive slope. However, both estimates come from small, restricted ranges. Before assigning economic meaning to the sign difference, inspect collinearity, functional form, and the limited variation within each group.
Exercise 7: transform a multiple regression correctly
Assume the error variance is proportional to X₂². Next, divide every term by X₂, including the intercept and the error. The resulting equation contains a constant because X₂/X₂ equals one.
The independently calculated transformed model is:
| Original-model parameter | OLS | WLS with 1/X₂² |
|---|---|---|
| Intercept | 12.088844 | 12.199835 |
| Sales slope | 0.0170295 | 0.0156786 |
| Productivity slope | 1.608471 | 1.622356 |
The coefficient changes are modest in this dataset. Nevertheless, their small size does not prove that the variance correction was unnecessary. Point estimates and uncertainty measures answer different questions.
Implementation check: fitting Y/X₂ on X₁/X₂ alone omits the transformed original intercept. Likewise, using weights 1/X₂ instead of 1/X₂² applies a different variance assumption. Both mistakes can produce plausible-looking output while solving the wrong problem.
Regression diagnostics for autocorrelation: exercises 8–10
Exercise 8: detect persistence in investment-model residuals
The historical example contains 18 annual observations from 1982 through 1999. Investment Y and GDP X₁ use billions of dollars, while X₂ records a commercial-paper interest rate. These values reproduce the supplied historical table; they do not represent a newly downloaded macroeconomic dataset.
First, regress investment on GDP alone. The resulting fit looks strong, but the residual dependence tells another story.
R² = 0.936853; Durbin–Watson d = 0.233636
The Durbin–Watson statistic measures the squared changes between successive residuals relative to their overall squared magnitude. According to the statsmodels definition, its familiar approximation is d ≈ 2(1 − r), where r summarizes lag-one residual correlation. Therefore, a value near zero signals substantial positive persistence.
The supplied answer classifies the initial result as significant at both 5% and 1% using the classical bounds approach. However, a formal decision requires the appropriate bounds and assumptions, not a universal “d below two” rule. Lagged dependent variables and estimated transformations require particular care.
Next, estimate the auxiliary equation with lagged investment and current and lagged GDP. This reproduces the supplied estimate of the persistence parameter closely.
Under an AR(1) error model, define Y*t = Yt − ρYt−1 and X*t = Xt − ρXt−1. Then fit the transformed regression. For a transparent one-step calculation, use ρ = 0.88 and omit the first observation.
R² = 0.815148; d = 0.822617; n = 17
Moreover, the transformed intercept equals (1 − ρ)β₀ under the AR(1) specification. It is not the original level intercept. The unrestricted auxiliary regression also does not impose all the coefficient restrictions of the structural AR(1) model, so treat its lag coefficient as a preliminary estimate rather than a complete model validation.
Exercise 9: add the interest rate and reassess the residuals
Adding an explanatory variable can improve R² without fixing residual dependence. Here, the GDP-and-interest-rate regression produces:
R² = 0.952872; d = 0.490833
The positive interest-rate coefficient describes a conditional association in this small historical sample. However, it does not establish that higher borrowing costs cause greater investment. Common trends, simultaneity, omitted expectations, and residual persistence all complicate that interpretation.
An auxiliary regression with lagged investment, current and lagged GDP, and current and lagged interest rates gives ρ ≈ 0.939624. Using the printed rounded value 0.94, the transformed model becomes:
R² = 0.775056; d = 1.019997
This calculation closely reproduces the supplied transformed coefficients. Nevertheless, the interest-rate t-statistic is approximately −0.140, which offers little evidence of a nonzero partial association under that fitted model. Residual dependence also remains a concern.
The printed exercise reports rejection at 5% and an inconclusive result at 1% using its bounds procedure. For applied work, document the testing convention and consider a suitable residual test after estimation. The Breusch–Godfrey procedure provides an auxiliary-regression approach for testing serial correlation at chosen lag orders, although 17 transformed observations leave little room for a rich lag structure.
Exercise 10: estimate a first-difference model
When the assumed persistence parameter equals one, quasi-differencing becomes ordinary first differencing. Therefore, define each change as the current observation minus the previous observation. The 18 annual levels produce 17 annual changes.
ΔŶt = −99.03661 + 0.449254ΔX1t − 0.912645ΔX2t
R² = 0.730189; d = 1.509055
For example, the first investment change equals 615.6 − 523.3 = 92.3 billion dollars. The corresponding GDP change equals 3688.8 − 3315.6 = 373.2 billion dollars. Meanwhile, the rate change equals 8.87 − 11.84 = −2.97 percentage points.
The GDP-change coefficient is approximately 0.4493. Thus, a $1 billion larger annual GDP change corresponds to about a $0.449 billion larger investment change, holding the rate change fixed in this fitted equation. That statement describes a change-on-change association rather than the original level relationship.
The printed answer reports no rejection of autocorrelation at its stated levels. However, failure to reject does not prove independence, particularly in such a small sample. A value of ρ near one can motivate investigation of differencing, but it does not by itself establish a unit root or rule out cointegration.
Before using a difference model for forecasting, inspect the time-series properties and economic interpretation. If a stable long-run relationship exists, an error-correction model may preserve information that pure differencing discards. Conversely, differencing an already stationary process can introduce unnecessary moving-average dependence.
| Specification | n | R² on its own outcome | Durbin–Watson |
|---|---|---|---|
| Investment on GDP | 18 | 0.93685 | 0.23364 |
| Investment on GDP and rate | 18 | 0.95287 | 0.49083 |
| One-step transformed GDP model, ρ = 0.88 | 17 | 0.81515 | 0.82262 |
| Transformed GDP and rate, ρ = 0.94 | 17 | 0.77506 | 1.02000 |
| First differences with a free intercept | 17 | 0.73019 | 1.50906 |
Regression diagnostics for measurement error: exercises 11–12
Exercise 11: compare accurate and noisy shipment measures
The inventory example contains 16 annual observations from 1983 through 1998. Here, Y denotes inventories, X denotes the exercise’s accurately measured shipments, and X′ denotes a hypothetical shipment measure with error. All three series use billions of dollars.
First, fit inventory on X. Next, replace X with X′ and compare the results.
Using X′: Ŷ = −70.98042 + 0.819643X′; R² = 0.906701
The noisy-measure slope is about 20.88% smaller than the benchmark slope. Nevertheless, its R² is higher by approximately 0.04285, or 4.29 percentage points. This dataset therefore offers a concrete counterexample to the idea that a higher R² confirms better measurement.
Under classical measurement error, write X′ = X + v, where the measurement error has mean zero and is uncorrelated with X and the structural error. In a simple regression, the large-sample slope then follows the attenuation relationship below.
The fraction lies between zero and one when both variances are positive. Consequently, the slope moves toward zero under those assumptions. Nonclassical measurement error can produce other directions of bias, and a single observed slope comparison cannot verify the classical assumptions.
Also, the coefficient from accurately measured X is a sample OLS benchmark, not a known population truth. Therefore, “closer to the benchmark” and “consistent for the causal effect” are different claims. The instrumental-variables chapter in Introduction to Econometrics with R explains why measurement error can require an identification strategy beyond adding regressors.
Exercise 11 continued: distinguish a lagged regressor from an instrument
The supplied answer uses lagged X′ and reports approximately −77.82 + 0.88X′t−1. Regressing current inventories directly on lagged noisy shipments reproduces that answer:
However, this changes the explanatory variable. A proper just-identified IV estimator retains current X′ as the regressor and uses lagged X′ as an instrument Z. With an intercept, the slope is a covariance ratio.
Zt = X′t−1
Using the 15 aligned observations from 1984 through 1998 gives a different structural equation:
Thus, the reported 0.8751 lag-regression slope is not the 0.8279 IV slope. The first denominator uses the variance of the instrument; the second uses its covariance with the current endogenous regressor. This distinction remains essential even when the two numbers happen to look similar.
For the IV interpretation to work, the instrument must predict current X′ and remain uncorrelated with the composite structural error. A lag does not automatically satisfy those requirements. Persistent measurement error, serially correlated structural shocks, and omitted dynamics can invalidate it.
Accordingly, the calculation above demonstrates mechanics rather than establishing a valid causal estimate. A defensible application would explain instrument relevance, exclusion, and exogeneity before interpreting the coefficient. Comparing all estimators on the same sample would also remove the sample change as a confounding factor.
Exercise 12: invert a reverse regression with care
The final supplied exercise regresses X′ on Y. Recalculation yields the following relationship:
Algebraically solving this fitted line for Y gives an intercept of −a/b and a slope of 1/b. Therefore, using the unrounded coefficients produces:
Y ≈ −91.74565 + 0.903983X′
The printed intercept of about −91.43 follows from dividing the rounded values 101.49 and 1.11. Consequently, this discrepancy largely reflects premature rounding. Preserve full precision until the final display to avoid that problem.
However, the bigger issue concerns interpretation. Reversing a regression and inverting its slope does not generally remove errors-in-variables bias when the original outcome contains structural noise. To see why, consider a centered population model with mutually uncorrelated X, u, and v.
Reverse slope b = Cov(X′,Y)/Var(Y)
b = βVar(X) / [β²Var(X) + Var(u)]
1/b = β + Var(u)/[βVar(X)], for β ≠ 0
Unless Var(u) equals zero, the inverted reverse slope generally differs from β. For a positive β, the extra term pushes it upward. Therefore, measurement error only in X is not, by itself, enough to justify the inverse-regression consistency claim.
A special calibration setting with an exact underlying relationship and noise only in X can support the method. Ordinary economic regressions usually include additional unexplained variation, so that stronger condition needs an argument. The finite-sample identity below provides another useful check:
0.819643 ÷ 0.903983 ≈ 0.906701
This identity follows directly from the two covariance formulas for simple OLS with intercepts. In other words, the difference between the forward and inverted slopes is mathematically tied to imperfect fit. It does not independently prove that either estimator has solved measurement error.
A numerical audit of the supplied answers
The following comparison separates reproduced results from discrepancies and qualifications. All recalculations use the visible observations, an intercept where specified, and full numerical precision before rounding. Therefore, readers can trace each difference to an explicit dataset or estimation convention.
| Item | Printed answer or shortcut | Independent result or qualification |
|---|---|---|
| Household predictor correlation | 0.995 | 0.999705 from the 15 visible pairs; VIF ≈ 1,695.43 |
| Simple-model GQ degrees of freedom | 11 and 11 | 12 and 12; 14 observations minus two parameters |
| Simple-model WLS slope | 0.074 | 0.0703853 from the visible observations |
| GDP-only quasi-difference fit | −70.67 + 0.23X*; d = 1.17 | At ρ = 0.88, dropping first row: −84.20339 + 0.241283X*; d = 0.822617 |
| Lagged shipment method | Presented as instrumental variables | Direct lag OLS slope 0.875119; current-X′ IV slope 0.827902 |
| Inverted reverse intercept | −91.43 | −91.74565 using full-precision coefficients |
| Inverse-regression consistency | Error only in X presented as sufficient | Also requires stronger conditions concerning structural outcome noise |
| Differencing with a constant | Presented as a correction | Free difference intercept adds drift beyond differencing a fixed level intercept |
Why the discrepancies matter beyond homework
A small rounding difference usually changes presentation rather than the conclusion. In contrast, replacing IV with a lagged-variable regression changes the estimand and the assumptions. Distinguishing these cases prevents a numerical answer key from becoming an accidental guide to the wrong method.
Similarly, correcting a degrees-of-freedom error may leave a strong rejection intact. However, the same error could change a borderline result in another dataset. Therefore, reconstruct the parameter count rather than copying a critical value from a nearby example.
A practical workflow for trustworthy regression diagnostics
Start with the question and the data
First, state whether the model aims to describe associations, forecast outcomes, or estimate a causal effect. Then verify units, timing, missing values, and any transformations. A model can perform well at one task while failing at another.
For historical economic data, also record the release vintage. The Federal Reserve’s ALFRED documentation explains that archival data preserve original releases and later revisions. Consequently, replacing an old table with today’s FRED observations can change a replication even when the variable names look identical.
Inspect the design and the residuals
Next, check for exact identities, duplicate predictors, and near-linear relationships. Plot residuals against fitted values and relevant predictors. For time-series data, also plot them in chronological order; arbitrary row ordering has no meaningful time interpretation.
Use VIFs to investigate coefficient precision, variance tests to investigate changing dispersion, and serial-correlation tests to investigate dependence. Nevertheless, each test has assumptions and limited power. A nonsignificant result in a sample of 15 or 18 observations deserves cautious language.
Match the correction to the problem
Heteroscedasticity-robust covariance estimates adjust estimated uncertainty while leaving the OLS coefficients unchanged. HAC covariance estimates extend that idea to certain forms of serial dependence. The statsmodels robust-covariance documentation lists HC0–HC3 and HAC options, including the choices required for time-series calculations.
By comparison, WLS changes the coefficient estimates through weighting. Dynamic specifications change the conditional mean, while instruments address a specific endogeneity problem under additional assumptions. Therefore, none of these tools serves as a universal repair.
| Situation | Reasonable next step | What that step does not establish |
|---|---|---|
| Cross-sectional unequal variance | Inspect mean specification; consider HC3 or justified WLS | That omitted-variable bias has disappeared |
| Serially dependent residuals | Inspect dynamics; consider HAC or an explicit error process | That the regressor is exogenous |
| Severe collinearity | Review separate effects, data support, and restrictions | That deleting a theoretically important variable is harmless |
| Noisy explanatory variable | Seek validation data or justified identification | That any lag is a valid instrument |
| Trending economic levels | Investigate stationarity and long-run relationships | That a high R² represents a stable causal relationship |
Report the model and its limits together
Finally, report the sample size, variable units, equation, estimation method, uncertainty estimator, and diagnostic results. Explain whether transformed models retain or omit the first observation. When using weights, state the exact formula and its economic or measurement basis.
A useful report might say: “The original residuals show strong positive persistence, so we estimated a specified AR(1) transformation and examined the remaining dependence.” That sentence explains the motivation and the follow-up. Conversely, “we corrected the regression” leaves readers guessing about the actual procedure.
Complete input tables for independent replication
The tables below transcribe the supplied exercise pages. Here, the family example explicitly uses hypothetical observations, and the noisy shipment series is also hypothetical. Although the historical tables cite federal statistical sources, this article uses their printed vintage rather than claiming a fresh extraction from those agencies.
Household consumption, income, and wealth
| Family | Consumption C | Disposable income Yd | Wealth W |
|---|---|---|---|
| 1 | 32 | 36 | 144 |
| 2 | 11 | 12 | 47 |
| 3 | 15 | 16 | 63 |
| 4 | 17 | 18 | 70 |
| 5 | 16 | 17 | 67 |
| 6 | 13 | 14 | 52 |
| 7 | 18 | 20 | 79 |
| 8 | 20 | 23 | 90 |
| 9 | 14 | 15 | 58 |
| 10 | 17 | 18 | 70 |
| 11 | 41 | 50 | 204 |
| 12 | 17 | 19 | 76 |
| 13 | 33 | 37 | 149 |
| 14 | 20 | 22 | 86 |
| 15 | 18 | 19 | 76 |
Capital formation by sales group
Each cell in the capital-formation column represents a separate firm. Therefore, the five rows contain 35 observations altogether.
| Sales X | Capital formation Y: seven firms per row |
|---|---|
| 100 | 30.2, 30.5, 30.5, 30.7, 30.9, 31.2, 31.2 |
| 150 | 31.5, 31.5, 31.9, 32.3, 32.8, 33.4, 33.4 |
| 200 | 35.1, 35.7, 36.3, 36.9, 37.4, 37.4, 37.8 |
| 250 | 38.4, 39.1, 40.2, 40.8, 42.1, 42.9, 43.2 |
| 300 | 44.3, 44.9, 45.2, 45.9, 46.5, 47.7, 48.5 |
Capital formation, sales, and productivity
| Firm | Capital formation Y | Sales X₁ | Productivity X₂ |
|---|---|---|---|
| 1 | 30.9 | 135 | 10.3 |
| 2 | 31.5 | 150 | 10.8 |
| 3 | 43.2 | 300 | 16.4 |
| 4 | 36.9 | 225 | 12.9 |
| 5 | 44.3 | 310 | 16.7 |
| 6 | 30.5 | 105 | 10.0 |
| 7 | 32.3 | 170 | 10.9 |
| 8 | 42.9 | 285 | 15.9 |
| 9 | 31.2 | 145 | 10.6 |
| 10 | 39.1 | 250 | 14.6 |
| 11 | 35.7 | 205 | 12.1 |
| 12 | 40.8 | 275 | 15.5 |
| 13 | 31.2 | 140 | 10.5 |
| 14 | 42.1 | 280 | 15.6 |
| 15 | 32.8 | 180 | 10.9 |
| 16 | 36.3 | 215 | 12.5 |
| 17 | 37.4 | 235 | 13.8 |
| 18 | 30.5 | 110 | 10.0 |
| 19 | 33.4 | 190 | 11.1 |
| 20 | 37.4 | 230 | 13.1 |
| 21 | 44.9 | 315 | 17.1 |
| 22 | 33.4 | 195 | 11.3 |
| 23 | 45.2 | 320 | 17.3 |
| 24 | 30.2 | 100 | 9.9 |
| 25 | 45.9 | 330 | 17.5 |
| 26 | 46.8 | 345 | 17.9 |
| 27 | 35.1 | 200 | 11.5 |
| 28 | 40.2 | 260 | 14.9 |
| 29 | 47.9 | 350 | 18.3 |
| 30 | 30.7 | 120 | 10.1 |
| 31 | 38.1 | 250 | 14.1 |
| 32 | 49.3 | 355 | 18.5 |
| 33 | 31.9 | 165 | 10.8 |
| 34 | 37.8 | 245 | 13.9 |
| 35 | 31.5 | 150 | 10.7 |
U.S. investment, GDP, and the commercial-paper rate
| Year | Investment Y | GDP X₁ | Interest rate X₂ |
|---|---|---|---|
| 1982 | 523.3 | 3315.6 | 11.84 |
| 1983 | 615.6 | 3688.8 | 8.87 |
| 1984 | 695.7 | 4033.5 | 10.07 |
| 1985 | 729.2 | 4319.3 | 7.94 |
| 1986 | 749.8 | 4537.5 | 6.61 |
| 1987 | 768.5 | 4891.6 | 6.74 |
| 1988 | 822.9 | 5258.3 | 7.58 |
| 1989 | 850.1 | 5588.0 | 9.11 |
| 1990 | 824.2 | 5847.3 | 8.15 |
| 1991 | 801.1 | 6080.7 | 5.89 |
| 1992 | 889.6 | 6469.8 | 3.71 |
| 1993 | 978.8 | 6795.5 | 3.17 |
| 1994 | 1071.6 | 7217.7 | 4.43 |
| 1995 | 1135.4 | 7529.3 | 5.93 |
| 1996 | 1250.9 | 7981.4 | 5.43 |
| 1997 | 1369.3 | 8478.6 | 5.54 |
| 1998 | 1524.1 | 8974.9 | 5.43 |
| 1999 | 1651.0 | 9559.7 | 5.12 |
U.S. durable-goods inventories and shipments
| Year | Inventories Y | Shipments X | Hypothetical noisy shipments X′ |
|---|---|---|---|
| 1983 | 85.48 | 199.85 | 205.21 |
| 1984 | 97.94 | 221.33 | 207.10 |
| 1985 | 101.28 | 218.19 | 217.16 |
| 1986 | 103.24 | 211.00 | 228.78 |
| 1987 | 108.13 | 220.80 | 228.06 |
| 1988 | 118.46 | 242.47 | 225.49 |
| 1989 | 123.16 | 257.51 | 218.77 |
| 1990 | 123.78 | 263.21 | 213.90 |
| 1991 | 121.00 | 250.02 | 222.48 |
| 1992 | 128.49 | 238.11 | 250.22 |
| 1993 | 135.89 | 239.33 | 263.72 |
| 1994 | 149.13 | 253.62 | 274.88 |
| 1995 | 160.59 | 268.35 | 282.01 |
| 1996 | 167.01 | 273.82 | 288.99 |
| 1997 | 179.89 | 286.37 | 301.30 |
| 1998 | 189.67 | 295.34 | 311.24 |
Reproduce the key regression diagnostics in Python
The following compact script uses NumPy and SciPy to reproduce several of the most consequential checks. It includes its own input arrays, so no data download is necessary. In addition, the calculations retain full precision until printing.
import numpy as np
from scipy.stats import f
def ols(y, x):
y = np.asarray(y, dtype=float)
x = np.asarray(x, dtype=float)
if x.ndim == 1:
x = x[:, None]
design = np.column_stack((np.ones(len(y)), x))
b = np.linalg.lstsq(design, y, rcond=None)[0]
e = y - design @ b
rss = e @ e
r2 = 1 - rss / ((y - y.mean()) @ (y - y.mean()))
return b, e, rss, r2
# Household collinearity
income = np.array([36,12,16,18,17,14,20,23,15,18,50,19,37,22,19])
wealth = np.array([144,47,63,70,67,52,79,90,58,70,204,76,149,86,76])
corr = np.corrcoef(income, wealth)[0, 1]
print("Correlation, VIF:", corr, 1 / (1 - corr**2))
# Goldfeld–Quandt and WLS
sales = np.repeat([100.,150.,200.,250.,300.], 7)
capital = np.array([
30.2,30.5,30.5,30.7,30.9,31.2,31.2,
31.5,31.5,31.9,32.3,32.8,33.4,33.4,
35.1,35.7,36.3,36.9,37.4,37.4,37.8,
38.4,39.1,40.2,40.8,42.1,42.9,43.2,
44.3,44.9,45.2,45.9,46.5,47.7,48.5])
low = ols(capital[:14], sales[:14])
high = ols(capital[-14:], sales[-14:])
f_stat = high[2] / low[2]
print("GQ F, p, critical:", f_stat, f.sf(f_stat,12,12), f.ppf(.95,12,12))
print("Transformed intercept, coefficient on 1/X:",
ols(capital/sales, 1/sales)[0])
# Direct lag regression versus actual IV
inventories = np.array([85.48,97.94,101.28,103.24,108.13,118.46,
123.16,123.78,121.,128.49,135.89,149.13,160.59,167.01,179.89,189.67])
noisy = np.array([205.21,207.10,217.16,228.78,228.06,225.49,
218.77,213.90,222.48,250.22,263.72,274.88,282.01,288.99,301.30,311.24])
outcome, current, instrument = inventories[1:], noisy[1:], noisy[:-1]
print("Direct lag OLS:", ols(outcome, instrument)[0])
zc = instrument - instrument.mean()
beta_iv = (zc @ (outcome-outcome.mean())) / (zc @ (current-current.mean()))
alpha_iv = outcome.mean() - beta_iv*current.mean()
print("IV intercept and current-X slope:", alpha_iv, beta_iv)
reverse_b = ols(noisy, inventories)[0]
print("Inverted reverse fit:", -reverse_b[0]/reverse_b[1], 1/reverse_b[1])
To reproduce the other equations, enter the corresponding table columns and call the same OLS function. For the AR(1) calculation, form y[1:] − ρ × y[:-1] and apply the identical transformation to every nonconstant regressor. Then include a transformed-regression intercept and record that the first observation was omitted.
Frequently asked questions about regression diagnostics
Can a regression with R² above 0.99 still be unreliable?
Yes. The household example reaches R² = 0.99429 while income and wealth remain almost indistinguishable statistically. Therefore, strong overall fit does not establish precise individual effects, correct uncertainty estimates, or causality.
Does multicollinearity automatically bias OLS?
No. High but imperfect collinearity mainly affects precision under the usual exogeneity assumptions. Perfect collinearity creates a different problem because the unrestricted coefficients lack a unique solution.
Should I always remove the variable with the highest VIF?
No. Removing a necessary control can introduce omitted-variable bias or change the research question. Instead, evaluate the variable’s purpose, the information available in the data, and whether prediction or separate coefficient interpretation matters most.
Do robust standard errors fix bad coefficients?
No. They change the estimated covariance matrix, not the OLS point estimates. Consequently, they cannot eliminate measurement-error bias, reverse causality, or a misspecified conditional mean.
Is Durbin–Watson close to two proof of independent errors?
No. The statistic focuses on a particular aspect of serial dependence. Moreover, small samples and model-specific assumptions limit what a near-two value can establish.
Why does WLS move the intercept in the transformed equation?
Dividing by X turns the original slope term β₁X into the constant β₁. Meanwhile, the original intercept becomes β₀/X. Tracking those positions prevents a correct transformed regression from receiving an incorrect economic interpretation.
Does first differencing always remove autocorrelation?
No. It can reduce persistence in some settings and introduce dependence in others. Therefore, recheck the transformed residuals and justify the time-series specification.
Can a lagged variable serve as an instrument?
Sometimes, but only with a valid identification argument. Relevance alone is insufficient; the lag must also satisfy the necessary orthogonality and exclusion conditions. Directly replacing the current regressor with its lag estimates a different regression.
Are the historical figures current economic statistics?
No. They reproduce the historical exercise tables, including their original rounding and data vintage. For current analysis, retrieve an appropriate series and document its definitions, frequency, units, and release date.
Conclusion: diagnose the assumption before choosing the fix
Regression diagnostics become useful when they connect a visible symptom to a specific statistical assumption. These 12 exercises show why impressive fit, significant coefficients, and familiar transformations cannot substitute for that reasoning. In particular, the independent audit demonstrates how small numerical checks can reveal much larger conceptual differences.
Start with the data and the research question. Then inspect the design, study the residuals, choose a justified response, and report the remaining uncertainty. That process produces an analysis readers can reproduce and evaluate rather than an equation they must simply trust.
Sources and methodology
Exercise source: user-supplied photographs of Chapter 9, “Problems in Regression Analysis,” supplementary exercises 9.16–9.27, including Tables 9.16–9.20 and printed pages 223–227. The photographs do not establish the book’s full bibliographic identity, so this article does not invent an author, edition, or publication date.
Calculation method: independent least-squares calculations from the visible numeric tables; classical t-statistics use residual variance divided by residual degrees of freedom. F-test p-values use the stated one-sided alternative. Charts show these same exercise data, and all comparisons distinguish printed answers from the explicit recalculation convention.
Interpretive limits: these small educational datasets illustrate methods rather than establish present-day economic relationships. The article does not claim that an instrument is valid merely because its coefficient is computable. Likewise, numerical proximity to a benchmark does not demonstrate consistency or causal identification.
- Penn State, STAT 462: Detecting Multicollinearity Using Variance Inflation Factors.
https://online.stat.psu.edu/stat462/node/180/ - NIST/SEMATECH e-Handbook: Weighted Least Squares Regression.
https://itl.nist.gov/div898/handbook/pmd/section1/pmd143.htm - statsmodels: Goldfeld–Quandt test.
https://www.statsmodels.org/stable/generated/statsmodels.stats.diagnostic.het_goldfeldquandt.html - statsmodels: Durbin–Watson statistic.
https://www.statsmodels.org/stable/generated/statsmodels.stats.stattools.durbin_watson.html - statsmodels: Breusch–Godfrey test.
https://www.statsmodels.org/stable/generated/statsmodels.stats.diagnostic.acorr_breusch_godfrey.html - Introduction to Econometrics with R: Instrumental Variables Regression.
https://www.econometrics-with-r.org/12-ivr.html - statsmodels: Robust covariance results.
https://www.statsmodels.org/stable/generated/statsmodels.regression.linear_model.RegressionResults.get_robustcov_results.html - Federal Reserve Bank of St. Louis: ALFRED archival data documentation.
https://fred.stlouisfed.org/docs/api/fred/alfred.html
