dw.test | R Documentation |
Durbin-Watson Test on AR(1) autocorrelation of errors in a linear model. The object of test results returned by this command can be plotted using the plot()
function.
dw.test(
mod,
data = list(),
dir = c("left", "right", "both"),
method = c("pan1", "pan2", "paol", "spa"),
crit.val = TRUE,
sig.level = 0.05,
details = FALSE,
hyp = TRUE
)
mod |
estimated linear model object or formula describing the model. |
data |
if |
dir |
direction of the alternative hypothesis: |
method |
algorithm used to calculate the p-value. |
crit.val |
logical value indicating whether the critical value should be calculated. |
sig.level |
significance level. Default value: |
details |
logical value indicating whether specific details about the test should be returned. |
hyp |
logical value indicating whether the Hypotheses should be returned. |
A list object including:
hyp | character matrix of hypotheses (if hyp = TRUE ). |
results | a data frame of basic test results, including critical- and p-value. |
nulldist | type of the null distribution (for internal use). |
Durbin, J. & Watson, G.S. (1950): Testing for Serial Correlation in Least Squares Regression I. Biometrika 37, 409-428.
Paolella (2007): Intermediate Probability - A Computational Approach, Wiley.
ddw
, pdw
.
## Estimate a simple model
filter.est <- ols(sales ~ price, data = data.filter)
## Perform Durbin Watson test for positive autocorrelation rho > 0 (i.e. d < 2)
test.results <- dw.test(filter.est)
## Print the test results
test.results
## Calculate DW null-distribution and plot the test results
plot(test.results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.