dwtest(formula, alternative = c("greater", "two.sided", "less"),
iterations = 15, exact = NULL, tol = 1e-10, data = list())
FALSE
a normal approximation
will be used to compute the p value, if TRUE
the "pan"
algorithm is used. The default is to use "pan" if the sample size
is < 100.tol
to be treated as non-zero.dwtest
is called from."htest"
containing:
alternative
argument.The null distribution of the Durbin-Watson test statistic is a linear combination of chi-squared distributions. The p value is computed using a Fortran version of the Applied Statistics Algorithm AS 153 by Farebrother (1980, 1984). This algorithm is called "pan" or "gradsol". For large sample sizes the algorithm might fail to compute the p value; in that case a warning is printed and an approximate p value will be given; this p value is computed using a normal approximation with mean and variance of the Durbin-Watson test statistic.
Examples can not only be found on this page, but also on the help pages of the
data sets bondyield
, currencysubstitution
,
growthofmoney
, moneydemand
,
unemployment
,
wages
.
For an overview on R and econometrics see Racine & Hyndman (2002).
J. Durbin & G.S. Watson (1951), Testing for Serial Correlation in Least Squares Regression II. Biometrika 38, 159--178.
J. Durbin & G.S. Watson (1971), Testing for Serial Correlation in Least Squares Regression III. Biometrika 58, 1--19.
R.W. Farebrother (1980), Pan's Procedure for the Tail Probabilities of the Durbin-Watson Statistic (Corr: 81V30 p189; AS R52: 84V33 p363- 366; AS R53: 84V33 p366- 369). Applied Statistics 29, 224--227.
R. W. Farebrother (1984),
[AS R53] A Remark on Algorithms AS 106 (77V26 p92-98), AS 153 (80V29 p224-227)
and AS 155: The Distribution of a Linear Combination of $
W. Kr�mer & H. Sonnberger (1986), The Linear Regression Model under Test. Heidelberg: Physica.
J. Racine & R. Hyndman (2002), Using R To Teach Econometrics. Journal of Applied Econometrics 17, 175--189.
## generate regressor and dependent variable x <- rep(c(-1,1), 50) y1 <- 1 + x + err1
## perform Durbin-Watson test dwtest(y1 ~ x)
if(library(ts, logical = TRUE)) {
err2 <- filter(err1, 0.9, method="recursive")
y2 <- 1 + x + err2
dwtest(y2 ~ x) }