pettitt.test: Pettitt's Test for Change-Point Detection

View source: R/pettitt.test.R

pettitt.testR Documentation

Pettitt's Test for Change-Point Detection

Description

Performes a non-parametric test after Pettitt in order to test for a shift in the central tendency of a time series. The H0-hypothesis, no change, is tested against the HA-Hypothesis, change.

Usage

pettitt.test(x)

Arguments

x

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

Details

In this function, the test is implemented as given by Verstraeten et. al. (2006), where the ranks r_1, \ldots, r_n of the X_i, \ldots, X_n are used for the statistic:

U_k = 2 \sum_{i=1}^k r_i - k \left(n + 1\right) \qquad k = 1, \ldots, n

The test statistic is the maximum of the absolute value of the vector:

\hat{U} = \max |U_k|

.

The probable change-point K is located where \hat{U} has its maximum. The approximate probability for a two-sided test is calculated according to

p = 2 \exp^{-6K^2 / (T^3 + T^2)}

Value

A list with class "htest" and "cptest"

Note

The current function is for complete observations only. The approximate probability is good for p \le 0.5.

References

CHR (ed., 2010), Das Abflussregime des Rheins und seiner Nebenfluesse im 20. Jahrhundert, Report no I-22 of the CHR, p. 172.

Pettitt, A. N. (1979), A non-parametric approach to the change point problem. Journal of the Royal Statistical Society Series C, Applied Statistics 28, 126-135.

G. Verstraeten, J. Poesen, G. Demaree, C. Salles (2006), Long-term (105 years) variability in rain erosivity as derived from 10-min rainfall depth data for Ukkel (Brussels, Belgium): Implications for assessing soil erosion rates. Journal of Geophysical Research 111, D22109.

See Also

efp sctest.efp

Examples

data(maxau) ; plot(maxau[,"s"])
s.res <- pettitt.test(maxau[,"s"])
n <- s.res$nobs
i <- s.res$estimate
s.1 <- mean(maxau[1:i,"s"])
s.2 <- mean(maxau[(i+1):n,"s"])
s <- ts(c(rep(s.1,i), rep(s.2,(n-i))))
tsp(s) <- tsp(maxau[,"s"])
lines(s, lty=2)
print(s.res)


data(PagesData) ; pettitt.test(PagesData)
 

trend documentation built on Oct. 10, 2023, 9:06 a.m.