Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

durbinWatsonTest

Durbin-Watson Test for Autocorrelated Errors


Description

Computes residual autocorrelations and generalized Durbin-Watson statistics and their bootstrapped p-values. dwt is an abbreviation for durbinWatsonTest.

Usage

durbinWatsonTest(model, ...)

dwt(...)

## S3 method for class 'lm'
durbinWatsonTest(model, max.lag=1, simulate=TRUE, reps=1000,
    method=c("resample","normal"),
    alternative=c("two.sided", "positive", "negative"), ...)

## Default S3 method:
durbinWatsonTest(model, max.lag=1, ...)

## S3 method for class 'durbinWatsonTest'
print(x, ...)

Arguments

model

a linear-model object, or a vector of residuals from a linear model.

max.lag

maximum lag to which to compute residual autocorrelations and Durbin-Watson statistics.

simulate

if TRUE p-values will be estimated by bootstrapping.

reps

number of bootstrap replications.

method

bootstrap method: "resample" to resample from the observed residuals; "normal" to sample normally distributed errors with 0 mean and standard deviation equal to the standard error of the regression.

alternative

sign of autocorrelation in alternative hypothesis; specify only if max.lag = 1; if max.lag > 1, then alternative is taken to be "two.sided".

...

arguments to be passed down.

x

durbinWatsonTest object.

Value

Returns an object of type "durbinWatsonTest".

Note

p-values are available only from the lm method.

Author(s)

References

Fox, J. (2016) Applied Regression Analysis and Generalized Linear Models, Third Edition. Sage.

Examples

durbinWatsonTest(lm(fconvict ~ tfr + partic + degrees + mconvict, data=Hartnagel))

car

Companion to Applied Regression

v3.0-10
GPL (>= 2)
Authors
John Fox [aut, cre], Sanford Weisberg [aut], Brad Price [aut], Daniel Adler [ctb], Douglas Bates [ctb], Gabriel Baud-Bovy [ctb], Ben Bolker [ctb], Steve Ellison [ctb], David Firth [ctb], Michael Friendly [ctb], Gregor Gorjanc [ctb], Spencer Graves [ctb], Richard Heiberger [ctb], Pavel Krivitsky [ctb], Rafael Laboissiere [ctb], Martin Maechler [ctb], Georges Monette [ctb], Duncan Murdoch [ctb], Henric Nilsson [ctb], Derek Ogle [ctb], Brian Ripley [ctb], William Venables [ctb], Steve Walker [ctb], David Winsemius [ctb], Achim Zeileis [ctb], R-Core [ctb]
Initial release
2020-09-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.