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

ww.test

Wald-Wolfowitz Test for Independence and Stationarity


Description

Performes the non-parametric Wald-Wolfowitz test for independence and stationarity.

Usage

ww.test(x)

Arguments

x

a vector or a time series object of class "ts"

Details

Let x_1, x_2, ..., x_n denote the sampled data, then the test statistic of the Wald-Wolfowitz test is calculated as:

R = sum(x[1:(n-1)] * x[2:n]) + x[1] * x[n]

The expected value of R is:

E(R) = (s1^2 - s2) / (n - 1)

The expected variance is:

V(R) = (s2^2 - s4) / (n - 1) - er^2 + (s1^4 - 4 * s1^2 * s2 + 4 * s1 * s3 + s2^2 - 2 * s4) / ((n - 1) * (n - 2))

with:

st = sum(x^t), ~~ t = 1, 2, 3, 4

For n > 10 the test statistic is normally distributed, with:

z = (R - E(R)) / V(R)^0.5

ww.test calculates p-values from the standard normal distribution for the two-sided case.

Value

An object of class "htest"

method

a character string indicating the chosen test

data.name

a character string giving the name(s) of the data

statistic

the Wald-Wolfowitz z-value

alternative

a character string describing the alternative hypothesis

p.value

the p-value for the test

Note

NA values are omitted.

References

R. K. Rai, A. Upadhyay, C. S. P. Ojha and L. M. Lye (2013), Statistical analysis of hydro-climatic variables. In: R. Y. Surampalli, T. C. Zhang, C. S. P. Ojha, B. R. Gurjar, R. D. Tyagi and C. M. Kao (ed. 2013), Climate change modelling, mitigation, and adaptation. Reston, VA: ASCE. doi = 10.1061/9780784412718.

A. Wald and J. Wolfowitz (1943), An exact test for randomness in the non-parametric case based on serial correlation. Annual Mathematical Statistics 14, 378–388.

WMO (2009), Guide to Hydrological Practices. Volume II, Management of Water Resources and Application of Hydrological Practices, WMO-No. 168.

Examples

ww.test(nottem)
ww.test(Nile)

set.seed(200)
x <- rnorm(100)
ww.test(x)

trend

Non-Parametric Trend Tests and Change-Point Detection

v1.1.4
GPL-3
Authors
Thorsten Pohlert [aut, cre] (<https://orcid.org/0000-0003-3855-3025>)
Initial release
2020-09-17

We don't support your browser anymore

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