R Regress Post Estimation Time Series
R Regress Post Estimation Time Series
com
regress postestimation time series — Postestimation tools for regress with time series
Postestimation commands
The following postestimation commands for time series are available for regress:
Command Description
estat archlm test for ARCH effects in the residuals
estat bgodfrey Breusch–Godfrey test for higher-order serial correlation
estat durbinalt Durbin’s alternative test for serial correlation
estat dwatson Durbin–Watson d statistic to test for first-order serial correlation
estat sbcusum perform cumulative sum test for parameter stability
estat sbknown perform tests for a structural break with a known break date
estat sbsingle perform tests for a structural break with an unknown break date
These commands provide regression diagnostic tools specific to time series. You must tsset your data before using
these commands; see [TS] tsset.
estat archlm
1
2 regress postestimation time series — Postestimation tools for regress with time series
estat bgodfrey
estat durbinalt
estat dwatson
Description for estat dwatson
estat dwatson computes the Durbin–Watson d statistic (Durbin and Watson 1950) to test for
first-order serial correlation in the disturbance when all the regressors are strictly exogenous.
H0 : ρ1 = 0, . . . , ρp = 0
and the alternative is that at least one of the ρ’s is nonzero. Although the null hypothesis was originally
derived for an AR(p) process, this test turns out to have power against MA(p) processes as well. Hence,
the actual null of this test is that there is no serial correlation up to order p because the MA(p) and
the AR(p) models are locally equivalent alternatives under the null. See Godfrey (1988, 113–115) for
a discussion of this result.
Durbin’s alternative test is in fact a LM test, but it is most easily computed with a Wald test on
the coefficients of the lagged residuals in an auxiliary OLS regression of the residuals on their lags
and all the covariates in the original regression. Consider the linear regression model
in which the covariates x1 through xk are not assumed to be strictly exogenous and ut is assumed to
be i.i.d. and to have finite variance. The process is also assumed to be stationary. (See Wooldridge
[2020, sec. 11.1] for a discussion of stationarity.) Estimating the parameters in (1) by OLS obtains
the residuals ubt . Next another OLS regression is performed of u bt on u bt−1 , . . . , u
bt−p and the other
regressors,
u bt−1 + · · · + γp u
bt = γ1 u bt−p + β1 x1t + · · · + βk xkt + t (2)
where t stands for the random-error term in this auxiliary OLS regression. Durbin’s alternative test
is then obtained by performing a Wald test that γ1 , . . . , γp are jointly zero. The test can be made
robust to an unknown form of heteroskedasticity by using a robust VCE estimator when estimating
the regression in (2). When there are only strictly exogenous regressors and p = 1, this test is
asymptotically equivalent to the Durbin–Watson test.
The Breusch–Godfrey test is also an LM test of the null hypothesis of no autocorrelation versus the
alternative that ut follows an AR(p) or MA(p) process. Like Durbin’s alternative test, it is based on the
auxiliary regression (2), and it is computed as N R2 , where N is the number of observations and R2 is
the simple R2 from the regression. This test and Durbin’s alternative test are asymptotically equivalent.
The test statistic N R2 has an asymptotic χ2 distribution with p degrees of freedom. It is valid with
or without the strict exogeneity assumption but is not robust to conditional heteroskedasticity, even
if a robust VCE is used when fitting (2).
In fitting (2), the values of the lagged residuals will be missing in the initial periods. As noted by
Davidson and MacKinnon (1993), the residuals will not be orthogonal to the other covariates in the
model in this restricted sample, which implies that the R2 from the auxiliary regression will not be zero
when the lagged residuals are left out. Hence, Breusch and Godfrey’s N R2 version of the test may
overreject in small samples. To correct this problem, Davidson and MacKinnon (1993) recommend
setting the missing values of the lagged residuals to zero and running the auxiliary regression in (2)
over the full sample used in (1). This small-sample correction has become conventional for both the
Breusch–Godfrey and Durbin’s alternative test, and it is the default for both commands. Specifying
the nomiss0 option overrides this default behavior and treats the initial missing values generated by
regressing on the lagged residuals as missing. Hence, nomiss0 causes these initial observations to
be dropped from the sample of the auxiliary regression.
Durbin’s alternative test and the Breusch–Godfrey test were originally derived for the case covered
by regress without the vce(robust) option. However, after regress, vce(robust) and newey,
Durbin’s alternative test is still valid and can be invoked if the robust and force options are
specified.
6 regress postestimation time series — Postestimation tools for regress with time series
If we assume that wagegov is a strictly exogenous variable, we can use the Durbin–Watson test
to check for first-order serial correlation in the errors.
. estat dwatson
Durbin--Watson d-statistic( 2, 22) = .3217998
The Durbin–Watson d statistic, 0.32, is far from the center of its distribution (d = 2.0). Given 22
observations and two regressors (including the constant term) in the model, the lower 5% bound is about
0.997, much greater than the computed d statistic. Assuming that wagegov is strictly exogenous, we
can reject the null of no first-order serial correlation. Rejecting the null hypothesis does not necessarily
mean an AR process; other forms of misspecification may also lead to a significant test statistic. If we
are willing to assume that the errors follow an AR(1) process and that wagegov is strictly exogenous,
we could refit the model using arima or prais and model the error process explicitly; see [TS] arima
and [TS] prais.
If we are not willing to assume that wagegov is strictly exogenous, we could instead use Durbin’s
alternative test or the Breusch–Godfrey to test for first-order serial correlation. Because we have only
22 observations, we will use the small option.
. estat durbinalt, small
Durbin’s alternative test for autocorrelation
1 35.035 ( 1, 19 ) 0.0000
1 14.264 ( 1, 19 ) 0.0013
Both tests strongly reject the null of no first-order serial correlation, so we decide to refit the
model with two lags of consump included as regressors and then rerun estat durbinalt and
estat bgodfrey. Because the revised model includes lagged values of the dependent variable, the
Durbin–Watson test is not applicable.
. regress consump wagegovt L.consump L2.consump
Source SS df MS Number of obs = 20
F(3, 16) = 44.01
Model 702.660311 3 234.220104 Prob > F = 0.0000
Residual 85.1596011 16 5.32247507 R-squared = 0.8919
Adj R-squared = 0.8716
Total 787.819912 19 41.4642059 Root MSE = 2.307
consump
L1. 1.420536 .197024 7.21 0.000 1.002864 1.838208
L2. -.650888 .1933351 -3.37 0.004 -1.06074 -.241036
1 0.080 ( 1, 15 ) 0.7805
2 0.260 ( 2, 14 ) 0.7750
1 0.107 ( 1, 15 ) 0.7484
2 0.358 ( 2, 14 ) 0.7056
Engle (1982) suggests an LM test for checking for autoregressive conditional heteroskedasticity
(ARCH) in the errors. The pth-order ARCH model can be written as
1 5.543 1 0.0186
2 9.431 2 0.0090
3 9.039 3 0.0288
estat archlm shows the results for tests of ARCH(1), ARCH(2), and ARCH(3) effects, respectively. At
the 5% significance level, all three tests reject the null hypothesis that the errors are not autoregressive
conditional heteroskedastic. See [TS] arch for information on fitting ARCH models.
regress postestimation time series — Postestimation tools for regress with time series 9
Stored results
estat archlm stores the following in r():
Scalars
r(N) number of observations
r(k) number of regressors
r(N gaps) number of gaps
Macros
r(lags) lag order
Matrices
r(arch) test statistic for each lag order
r(df) degrees of freedom
r(p) two-sided p-values
n−1
bt )2
P
ut+1 − u
(b
t=1
d= n
b2t
P
u
t=1
where u
bt represents the residual of the tth observation.
To compute Durbin’s alternative test and the Breusch–Godfrey test against the null hypothesis that
there is no pth order serial correlation, we fit the regression in (4), compute the residuals, and then
fit the following auxiliary regression of the residuals u
bt on p lags of ubt and on all the covariates in
the original regression in (4):
u bt−1 + · · · + γp u
bt = γ1 u bt−p + β1 x1t + · · · + βk xkt + (5)
Durbin’s alternative test is computed by performing a Wald test to determine whether the coefficients
of u
bt−1 , . . . , u
bt−p are jointly different from zero. By default, the statistic is assumed to be distributed
χ2 (p). When small is specified, the statistic is assumed to follow an F (p, N − p − k ) distribution.
The reported p-value is a two-sided p-value. When robust is specified, the Wald test is performed
using the Huber/White/sandwich estimator of the variance–covariance matrix, and the test is robust
to an unspecified form of heteroskedasticity.
The Breusch–Godfrey test is computed as N R2 , where N is the number of observations in the
auxiliary regression (5) and R2 is the R2 from the same regression (5). Like Durbin’s alternative
test, the Breusch–Godfrey test is asymptotically distributed χ2 (p), but specifying small causes the
p-value to be computed using an F (p, N − p − k).
By default, the initial missing values of the lagged residuals are replaced with zeros, and the
auxiliary regression is run over the full sample used in the original regression of (4). Specifying the
nomiss0 option causes these missing values to be treated as missing values, and the observations are
dropped from the sample.
b2t on u
Engle’s LM test for ARCH(p) effects fits an OLS regression of u b2t−1 , . . . , u
b2t−p :
b2t = γ0 + γ1 u
u b2t−1 + · · · + γp u
b2t−p +
Acknowledgment
The original versions of estat archlm, estat bgodfrey, and estat durbinalt were written
by Christopher F. Baum of the Department of Economics at Boston College and author of the Stata
Press books An Introduction to Modern Econometrics Using Stata and An Introduction to Stata
Programming.
regress postestimation time series — Postestimation tools for regress with time series 11
References
Baum, C. F. 2006. An Introduction to Modern Econometrics Using Stata. College Station, TX: Stata Press.
Beran, R. J., and N. I. Fisher. 1998. A conversation with Geoff Watson. Statistical Science 13: 75–93.
https://doi.org/10.1214/ss/1028905975.
Breusch, T. S. 1978. Testing for autocorrelation in dynamic linear models. Australian Economic Papers 17: 334–355.
https://doi.org/10.1111/j.1467-8454.1978.tb00635.x.
Davidson, R., and J. G. MacKinnon. 1993. Estimation and Inference in Econometrics. New York: Oxford University
Press.
Durbin, J. 1970. Testing for serial correlation in least-squares regressions when some of the regressors are lagged
dependent variables. Econometrica 38: 410–421. https://doi.org/10.2307/1909547.
Durbin, J., and S. J. Koopman. 2012. Time Series Analysis by State Space Methods. 2nd ed. Oxford: Oxford
University Press.
Durbin, J., and G. S. Watson. 1950. Testing for serial correlation in least squares regression. I. Biometrika 37:
409–428. https://doi.org/10.2307/2332391.
. 1951. Testing for serial correlation in least squares regression. II. Biometrika 38: 159–177.
https://doi.org/10.2307/2332325.
Engle, R. F. 1982. Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom
inflation. Econometrica 50: 987–1007. https://doi.org/10.2307/1912773.
Fisher, N. I., and P. Hall. 1998. Geoffrey Stuart Watson: Tributes and obituary (3 December 1921–3 January 1998).
Australian and New Zealand Journal of Statistics 40: 257–267. https://doi.org/10.1111/1467-842X.00030.
Godfrey, L. G. 1978. Testing against general autoregressive and moving average error models when the regressors
include lagged dependent variables. Econometrica 46: 1293–1301. https://doi.org/10.2307/1913829.
. 1988. Misspecification Tests in Econometrics: The Lagrange Multiplier Principle and Other Approaches.
Econometric Society Monographs, No. 16. Cambridge: Cambridge University Press.
Klein, L. R. 1950. Economic Fluctuations in the United States 1921–1941. New York: Wiley.
Koopman, S. J. 2012. James Durbin, FBA, 1923–2012. Journal of the Royal Statistical Society, Series A 175:
1060–1064. https://doi.org/10.1111/j.1467-985X.2012.01068.x.
Phillips, P. C. B. 1988. The ET Interview: Professor James Durbin. Econometric Theory 4: 125–157.
https://doi.org/10.1017/S0266466600011907.
Savin, N. E., and K. J. White. 1977. The Durbin–Watson test for serial correlation with extreme sample sizes or
many regressors. Econometrica 45: 1989–1996. https://doi.org/10.2307/1914122.
Wooldridge, J. M. 2020. Introductory Econometrics: A Modern Approach. 7th ed. Boston: Cengage.
12 regress postestimation time series — Postestimation tools for regress with time series
James Durbin (1923–2012) was a British statistician who was born in Wigan, near Manchester. He
studied mathematics at Cambridge and after military service and various research posts joined the
London School of Economics in 1950. Later in life, he was also affiliated with University College
London. His many contributions to statistics centered on serial correlation, time series (including
major contributions to structural or unobserved components models), sample survey methodology,
goodness-of-fit tests, and sample distribution functions, with emphasis on applications in the
social sciences. He served terms as president of the Royal Statistical Society and the International
Statistical Institute.
Geoffrey Stuart Watson (1921–1998) was born in Victoria, Australia, and earned degrees at
Melbourne University and North Carolina State University. After a visit to the University of
Cambridge, he returned to Australia, working at Melbourne and then the Australian National
University. Following periods at Toronto and Johns Hopkins, he settled at Princeton. Throughout
his wide-ranging career, he made many notable accomplishments and important contributions,
including the Durbin–Watson test for serial correlation, the Nadaraya–Watson estimator in
nonparametric regression, and methods for analyzing directional data.
Leslie G. Godfrey (1946– ) was born in London and earned degrees at the Universities of Exeter
and London. He is now a professor of econometrics at the University of York. His interests
center on implementation and interpretation of tests of econometric models, including nonnested
models.
Trevor Stanley Breusch (1953– ) was born in Queensland and earned degrees at the University
of Queensland and Australian National University (ANU). After a post at the University of
Southampton, he returned to work at ANU. His background is in econometric methods and his
recent interests include political values and social attitudes, earnings and income, and measurement
of underground economic activity.
Also see
[R] regress — Linear regression
[R] regress postestimation — Postestimation tools for regress
[R] regress postestimation diagnostic plots — Postestimation plots for regress
[TS] tsset — Declare data to be time-series data