trend (version 1.1.1)

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


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.





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


A list with class "htest" and "cptest"


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)}$$


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


Run this code
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)

data(PagesData) ; pettitt.test(PagesData)
# }

Run the code above in your browser using DataCamp Workspace