View source: R/lanzante.test.R
lanzante.test | R Documentation |
Performes a non-parametric test after Lanzante in order to test for a shift in the central tendency of a time series. The null hypothesis, no shift, is tested against the alternative, shift.
lanzante.test(x, method = c("wilcox.test", "rrod.test"))
x |
a vector of class "numeric" or a time series object of class "ts" |
method |
the test method. Defaults to |
Let X
denote a continuous random variable, then the following model
with a single shift (change-point) can be proposed:
x_i = \left\{
\begin{array}{lcl}
\theta + \epsilon_i, & \qquad & i = 1, \ldots, m \\
\theta + \Delta + \epsilon_i & \qquad & i = m + 1, \ldots, n \\
\end{array} \right.
with \theta(\epsilon) = 0
. The null hypothesis, H:\Delta = 0
is tested against the alternative A:\Delta \ne 0
.
First, the data are transformed into increasing ranks and for each time-step the adjusted rank sum is computed:
U_k = 2 \sum_{i=1}^k r_i - k \left(n + 1\right) \qquad k = 1, \ldots, n
The probable change point is located at the absolute maximum of the statistic:
m = k(\max |U_k|)
.
For method = "wilcox.test"
the Wilcoxon-Mann-Whitney two-sample
test is performed, using m
to split the series. Otherwise,
the robust rank-order distributional test (rrod.test
is
performed.
A list with class "htest" and "cptest".
Lanzante, J. R. (1996), Resistant, robust and non-parametric techniques for the analysis of climate data: Theory and examples, including applications to historical radiosonde station data, Int. J. Clim., 16, 1197–1226.
pettitt.test
data(maxau) ; plot(maxau[,"s"])
s.res <- lanzante.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) ; lanzante.test(PagesData)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.