serial.test: Test for Serial Correlation

View source: R/serial.test.R

serial.testR Documentation

Test for Serial Correlation

Description

Performs either of two nonparametric tests (Wilcoxon Rank-Sum test or runs test) for serial correlation. Both tests compute Z, which is the product of sequential values of x after removing any trend and normalizing so that the median of Z values is 0.

Usage

serial.test(x, method = "wilcoxon")

Arguments

x

the numeric vector of observations. Missing values (NAs) are not allowed.

method

the string "wilcoxon" or "runs," depending on which test should be used. Only the first character is necessary. See Details.

Details

If the method is "wilcoxon," then the Wilcoxon Rank-Sum test (Wilcoxon, 1945) is performed to compare the distribution of positive Z values to the distribution of negative Z values. Excessive numbers of positive Z values suggests positive serial correlation and excessive negative Z values suggests negative serial correlation.

If the method is "runs," then the runs test (Wald and Wolfowitz, 1940) is performed on sequences of positive and negative values of Z. If there is a larger than expected number of runs, then that suggest negative serial correlation and if fewer than the expected number of runs, then positive serial correlation.

Value

An object of class htest containing the following components:

statistic

the score for either test.

p.value

the two-sided p-value of the statistic.

Z

the raw data of the analysis.

alternative

a string "two.sided" indicating the hypothesis.

method

a description of the method.

data.name

a string containing the actual name of the input data.

Note

The null hypothesis is that the data are uncorrelated.

References

Dufour, J.M., 1981, Rank test for serial dependence: Journal of the Time Series Analysis, v. 2, no. 3, p. 117–128.

Wald, A., and Wolfowitz, J., 1940, On a test whether two samples are from the same population: Annals of Mathematical Statistics, v. 11, p. 147–162.

Wilcoxon, F., 1945, Individual comparisons by ranking methods: Biometrics, v. 1, p. 80–83.


USGS-R/smwrStats documentation built on Oct. 11, 2022, 6:15 a.m.