Why Diagnose a GLS Covariance Model?
Generalized least squares (GLS) uses a specified covariance structure to account for nonconstant error variances or dependence among observations. A good fit of the conditional mean is not enough: if the covariance model is inadequate, the GLS estimator may be inefficient, and standard errors or predictions based on that structure may be unreliable. Residual diagnostics ask whether the transformed errors left after fitting behave consistently with the assumed covariance model.
The key is to inspect residuals on the scale on which the model assumes errors are uncorrelated and have a common variance. Patterns in the original residuals can be expected when the model explicitly allows unequal variances or dependence. In contrast, systematic patterns in whitened residuals can indicate that the fitted covariance structure has not removed them.
What Whitened Residuals Should Look Like
With known \(V\), GLS is ordinary least squares on the transformed regression \(Ay=AX\beta+Au\). Write \(Z=AX\), assume \(Z\) has full column rank, and define \(H=Z(Z'Z)^{-1}Z'\). The fitted transformed residuals are \(q=(I-H)Au\). Under the stated mean and covariance assumptions, their conditional covariance is not the identity: fitting the regression has used information to estimate \(\beta\).
Here \(H\) is a symmetric projection matrix, so \(H'=H\) and \(H^2=H\). The diagonal element \(h_{ii}\) of \(H\) is the leverage of transformed observation \(i\); \(q_i\) has variance \(1-h_{ii}\) under the model. A common descriptive adjustment is \(q_i/\sqrt{1-h_{ii}}\). Such standardization accounts for the different marginal variances, but does not make the residuals mutually independent: their covariance matrix still has off-diagonal elements \(-h_{ij}\).
These results apply conditional on \(X\) and known \(V\). In practice, covariance parameters are often estimated, so the whitening transformation itself is estimated. Residual plots remain useful, but tests that rely on a reference distribution may need a method that reflects both regression fitting and covariance-parameter estimation, such as a suitable score test or a parametric bootstrap.
Worked Example: Checking a Whitened Residual Sequence
Suppose a hypothetical time-ordered GLS fit produces six whitened residuals \(q=(1.2,\,0.8,\,-0.5,\,-1.0,\,-0.7,\,0.2)\). For a quick descriptive check, calculate their mean and lag-one autocorrelation using the convention that the numerator contains adjacent pairs and the denominator contains all six centered squared residuals.
The residual sum is \(1.2+0.8-0.5-1.0-0.7+0.2=0\), so \(\bar q=0\). Thus the lag-one numerator is \(1.2(0.8)+0.8(-0.5)+(-0.5)(-1.0)+(-1.0)(-0.7)+(-0.7)(0.2)\) \(=0.96-0.40+0.50+0.70-0.14=1.62\).
The denominator is \(1.2^2+0.8^2+(-0.5)^2+(-1.0)^2+(-0.7)^2+0.2^2 =1.44+0.64+0.25+1.00+0.49+0.04=3.86\). The descriptive lag-one autocorrelation is therefore \(1.62/3.86\approx0.4197\).
This positive value is a reason to examine the residual sequence and a more formal serial-correlation diagnostic; it is not, by itself, a test result. The sample is tiny, fitted residuals are dependent, and no valid p-value follows from treating this descriptive ratio as an ordinary sample correlation.
Plots for Covariance Patterns
Use plots to look for specific departures from the fitted covariance model, rather than expecting every plot to prove that the model is correct. A useful initial set includes standardized whitened residuals against time or observation order, against fitted values, and by group or cluster. Look for runs, changes in spread, clusters, or other structure that remains after whitening.
Covariance-pattern plots focus on products or dependence, not only on individual residuals. For ordered observations, plot adjacent products \(q_tq_{t-1}\) against time or inspect the autocorrelation function of the whitened residuals. For repeated observations within groups, examine residual pairs or within-group cross-products by separation or pair type. A systematic pattern in these quantities can suggest remaining dependence. Compare observed patterns with what the fitted covariance model implies; raw residuals need not be uncorrelated when the model intentionally allows correlation.
Plots are diagnostic, not decisive. A few extreme points can dominate squared residuals or cross-products, while low sample sizes can hide real departures. Interpret patterns in the context of the observation order, group structure, design matrix, and the covariance model that was actually fitted.
Targeted Tests for Remaining Structure
A formal diagnostic should target a plausible departure from the fitted covariance model. Under a correctly specified whitening transformation, the transformed errors have covariance \(I\); departures can be represented by additional covariance parameters. Tests can then assess whether those parameters are needed, with nuisance parameters and regression fitting handled in the test's reference distribution. A generic test for “any problem” can be less informative than a test tied to the suspected pattern.
- Serial correlation: test whether a specified lag or set of lags in the whitened errors has nonzero covariance. A residual-based auxiliary regression or score test can be used when its assumptions and calibration match the fitted regression. Do not apply an unadjusted time-series critical value to fitted residuals and call it an exact test.
- Groupwise heteroskedasticity: test whether the variance of whitened errors differs across prespecified groups. A variance model, such as a log-variance ratio, can be tested by a Wald or score procedure with appropriate uncertainty estimates.
- Other dependence: test covariance parameters corresponding to a meaningful structure, such as residual dependence within clusters or at particular distances. The test should respect which observations can be paired and how the model was estimated.
The null hypothesis for these diagnostics is that the additional covariance feature is absent, conditional on the specified mean and covariance model. A small p-value is evidence against that null under the test assumptions; it does not identify a unique replacement model or establish that a particular alternative is true. A large p-value means the test did not detect the targeted departure, not that the covariance model has been proved correct.
Worked Example: A Targeted Test for Groupwise Variance
Consider a hypothetical fitted GLS model whose whitened residuals are examined in two prespecified groups, each with 40 observations. The sums of squared residuals are 40 in group A and 64 in group B. For illustration, use the independent Gaussian benchmark in which the group residual variances are estimated by their mean squared residuals, and test equality of the two variances using a large-sample Wald approximation. In an applied regression, use leverage-aware variance estimates and a calibration appropriate to fitted and possibly estimated-whitening residuals.
The group variance estimates under this simplified calculation are \(\hat v_A=40/40=1.00\) and \(\hat v_B=64/40=1.60\). Define the log variance ratio \(\delta=\log(v_B/v_A)\). Its estimate is \(\hat\delta=\log(1.60/1.00)=\log(1.60)\approx0.4700\). Under independent Gaussian observations, the approximate variance of the log ratio is \(2/40+2/40=0.10\), giving \(SE(\hat\delta)=\sqrt{0.10}\approx0.3162\).
The null is \(H_0:\delta=0\), or equal group variances. The Wald statistic is \(W=(\hat\delta/SE(\hat\delta))^2=(0.4700/0.3162)^2\approx2.209\). Using a \(\chi^2\) reference distribution with one degree of freedom gives \(p\approx0.137\). At \(\alpha=0.05\), this benchmark test does not reject equal variances. The estimated variance in group B is larger, but the test does not provide sufficient evidence of a difference at that level. This conclusion is specific to the stated approximation and its assumptions.
Worked Example: Testing for Remaining Lag-One Dependence
Suppose a hypothetical time-ordered GLS analysis has 80 usable adjacent residual pairs. An auxiliary regression of \(q_t\) on \(q_{t-1}\), with no intercept because the transformed error has mean zero under the model, yields \(\sum q_{t-1}^2=80\) and \(\sum q_tq_{t-1}=16\). Use these summaries to illustrate a large-sample test of the targeted AR(1)-type coefficient, while recognizing that a real residual test must account for regression fitting and any estimated covariance parameters.
The auxiliary-regression estimate is \(\hat\rho=\sum q_tq_{t-1}/\sum q_{t-1}^2=16/80=0.2000\). Under the simplified independent, unit-variance Gaussian benchmark, the approximate standard error is \(1/\sqrt{80}\approx0.1118\). Thus \(z=0.2000/0.1118\approx1.789\), giving a two-sided normal-approximation p-value of about \(0.0737\).
At the 5% level this approximation does not reject \(H_0:\rho=0\). It does not show that the remaining lag-one covariance is exactly zero; rather, this test has not found sufficiently strong evidence against zero at the chosen level. With estimated GLS covariance parameters, an appropriately calibrated score or bootstrap test is preferable to relying automatically on this simplified reference calculation.
How to Use Diagnostics in Practice
Record the observation order or group structure, the assumed covariance \(V\), and whether its parameters were estimated.
Examine their scale, time or group patterns, and leverage-adjusted values. Look for structure that remains after the proposed transformation.
Choose a serial, groupwise variance, or other dependence feature based on the design and plots; state its null hypothesis before testing.
Report the statistic, reference distribution or calibration method, p-value, and practical pattern. Note limitations from small samples, leverage, and estimated covariance parameters.
Common Mistakes and Why Diagnostics Matter
- Inspecting only raw residuals. Raw residual correlation or unequal spread can be expected under the covariance model. Check whether the structure remains after whitening.
- Treating whitened residuals as independent after fitting. The regression projection makes their covariance \(I-H\), not \(I\). Leverage adjustment fixes marginal variances but not their mutual dependence.
- Calling a descriptive statistic a formal test. A residual autocorrelation or visible variance difference is a diagnostic clue. A p-value requires a specified null, a valid reference distribution, and calibration that accounts for fitting.
- Taking a nonsignificant result as proof. A test can miss departures, especially with few observations or weak signals. Report what pattern was tested and what the data support, not that the covariance model is certainly correct.
- Assuming a rejected null chooses the solution. Evidence of a remaining pattern motivates further modeling and validation; it does not by itself determine which covariance structure should replace the fitted one.
Covariance diagnostics matter because GLS inference depends on more than a plausible mean equation. Whitened residuals, pattern-specific plots, and appropriately calibrated tests provide complementary checks: plots reveal where structure may remain, while targeted tests quantify evidence against a stated covariance assumption. Neither replaces substantive understanding of how observations were generated.
Check Your Understanding
Answer each question using the definitions and assumptions stated above.
- Why does the covariance of fitted whitened residuals equal \(I-H\), rather than \(I\), when \(V\) is known?
- A residual plot shows a trend over time before whitening but no clear trend afterward. What does this suggest, and what does it not prove?
- What is the descriptive lag-one autocorrelation for the six residuals in the first worked example, and why is it not by itself a formal test?
- In the groupwise variance example, what null hypothesis is tested, and how should the result be interpreted at the 5% level?
- Why might a parametric bootstrap be useful when the GLS covariance parameters were estimated from the same data?