Serial Correlation Testing |
In all cases considered, the null hypothesis is absence of serial correlation:
\begin{equation} y = {\bf{X}}\beta + u\) , \(E\left[ u \right] = 0,{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} E\left[ {uu'} \right] = {\bf{D}} \end{equation}
where \(\bf(D)\) is assumed to be diagonal, and is also usually required to be scalar (\(\sigma ^2 \bf{I}\) as well. Alternatives range from first order autoregressive errors to high order moving average errors.
Residual serial correlation is generally a much more serious issue than heteroscedasticity. The whole point of many models is to describe the dynamics of a process, so leaving serial correlation behind is often the sign of a flawed model.
Standard Tests
RATS instructions such as LINREG include the Durbin-Watson test for first order serial correlation. While it’s routinely reported in regression results, the assumptions underlying it are rarely met in practice. It is biased towards acceptance of the null when there are lagged dependent variables in the regression, as well as for ARMA models. As such it’s now used more as a rough guide, where values near 2 are ok, values far from it, not.
BOXJENK, AR1 and ITERATE compute in addition the Ljung-Box Q for higher order serial correlation. The number of correlations used depend upon the sample size and are decided by RATS. If you would like to control this yourself, use the instructions or procedures below.
The Ljung–Box Q (1978) tests against high-order serial correlation. It has low power against specific alternatives, such as first order serial correlation, but can detect the more subtle problems which arise because of a misspecified ARMA model. It also can be applied in a wide range of circumstances, not just linear regressions.
BOXJENK includes Q tests for a fixed number of lags in the summary statistics. You can also use the QSTATS option on CORRELATE or CROSS to do Q tests on autocorrelations or cross-correlations. For instance, the CORRELATE here computes Q tests for lags 1 through 8, 1 through 16, and 1 through 24 (the SPAN option controls the gaps between tested numbers of lags).
boxjenk(ar=2,ma=1,diffs=1) y / resids
correlate(qstats,number=24,span=8,dfc=%NARMA) resids
The Q test has a known asymptotic distribution (under the null of no serial correlation) only when applied to the residuals from an ARMA model, where it is asymptotically \(\chi ^2\) with degrees of freedom equal to the number of correlations minus the number of estimated ARMA parameters (which BOXJENK puts into the variable %NARMA). RATS does not correct the degrees of freedom in any other situation. You can include your own correction using the DFC option as is done above.
A simpler approach is to use the procedure @REGCORRS to analyze the autocorrelations of residuals. This can produce either a graph or a report (or both) showing the correlations and Q tests. The syntax of this procedure is
@regcorrs( options ) series of residuals
where the main options are
[graph]/nograph
report/[noreport]
method=yule/[burg]
number=number of autocorrelations to compute
dfc=degrees of freedom correction for the Q statistic
The advantage of the graph and/or detailed report over just a single Q test is that you can more easily determine if the diagnostics are showing any “correctable” serial correlation. Time series models can often be adjusted to largely eliminate residual serial correlation if it’s on short lags (1 or 2 for instance), or at and around seasonals. However, if an apparently significant Q is due mainly to a “spike” at a location which is hard to explain (lag 7 for instance), you may have to stick with the model you have and chalk up the significant Q to the behavior of this particular sample.
SCTEST.RPF example
SCTEST.RPF uses one of the series from West and Cho(1995). The change in the log of the Canadian/US exchange rate would not be expected to show serial correlation, so this tests that. Note that here there is no model to estimate. This does Q Tests using both CORRELATE and the @REGCORRS procedure.
correlate(qstats,number=40,span=10) xcan
@regcorrs(number=40,graph,report,nocrit,$
title="Correlations of Can$ Exchange Rate") xcan
The Q test relies upon an assumption of conditional homoscedasticity to generate its asymptotics. West and Cho(1995) propose a similar test which uses a robust estimate of the fourth moments to deflate the correlations. (Interestingly, this test is basically a footnote in a paper on a different subject). This “robust” Q test can be done using the @WestChoTest procedure. Its principal option is the NUMBER=number of autocorrelations to compute. The following is from SCTEST.RPF:
@westchotest(number=40) xcan
Cumulated Periodogram Test
This competes with the Q test as a test for general serial correlation. Because it uses frequency domain techniques, the technical details are covered in the description of CACCUMULATE. However, all you need to do is invoke the procedure @CUMPDGM to use the test. From SCTEST.RPF:
@cumpdgm xcan
@CUMPDGM reports a Kolmogorov–Smirnov statistic and generates a graph. The K–S test is a general test for whether an empirical distribution comes from a hypothesized distribution. @CUMPDGM prints (large-sample) critical values for the test.
General LM Tests (Breusch-Godfrey)
The Q, West-Cho and Cumulated Periodogram tests apply in a wide range of situations, but generally have fairly low power against specific low order alternatives. For diagnostics in a linear regression, Godfrey (1978) and Breusch (1978) have proposed a test against an alternative of serial correlation of order N, in either autoregressive or moving average form. This involves regressing the residuals on the original explanatory variables plus one or more lags of the residuals (here one):
linreg %resids
# constant logc{1} logy %resids{1}
cdf(title="Breusch-Godfrey SC Test") chisqr %trsq 1
Durbin’s h
The Durbin-Watson test is biased towards a finding of no serial correlation when the model contains a lagged dependent variable. Durbin (1970) proposed an alternative test for such situations, using the “h-statistic.” While you can compute h using RATS (as shown below), we would strongly urge you to use the Breusch-Godfrey test (above), since it is simpler and more robust. (Durbin’s result is, in effect, the B-G test with terms eliminated by assumption).
linreg logc
# constant logc{1} logy
compute h=sqrt(%nobs)*%rho/sqrt(1-%nobs*%stderrs(2)^2)
cdf(title="Durbin h test") normal h
Copyright © 2025 Thomas A. Doan