Performes the Standard Normal Homogeinity Test (SNHT) for change-point detection of a normal variate.
snh.test(x, m = 20000)
a vector of class "numeric" or a time series object of class "ts"
numeric, number of Monte-Carlo replicates, defaults to 20000
A list with class "htest" and "cptest"
character string that denotes the input data
the p-value
the test statistic
the null hypothesis
the time of the probable change point
the alternative hypothesis
character string that denotes the test
numeric vector of Tk for plotting
Let \(X\) denote a normal random variate, then the following model with a single shift (change-point) can be proposed:
$$ x_i = \left\{ \begin{array}{lcl} \mu + \epsilon_i, & \qquad & i = 1, \ldots, m \\ \mu + \Delta + \epsilon_i & \qquad & i = m + 1, \ldots, n \\ \end{array} \right.$$
with \(\epsilon \approx N(0,\sigma)\). The null hypothesis \(\Delta = 0\) is tested against the alternative \(\Delta \ne 0\).
The test statistic for the SNHT test is calculated as follows:
$$T_k = k z_1^2 + \left(n - k\right) z_2^2 \qquad (1 \le k < n)$$
where
$$ \begin{array}{l l} z_1 = \frac{1}{k} \sum_{i=1}^k \frac{x_i - \bar{x}}{\sigma} & z_2 = \frac{1}{n-k} \sum_{i=k+1}^n \frac{x_i - \bar{x}}{\sigma}. \\ \end{array}$$
The critical value is: $$T = \max T_k.$$
The p.value
is estimated with a Monte Carlo simulation
using m
replicates.
Critical values based on \(m = 1,000,000\) Monte Carlo simulations are tabulated for \(T\) by Khaliq and Ouarda (2007).
H. Alexandersson (1986), A homogeneity test applied to precipitation data, Journal of Climatology 6, 661--675.
M. N. Khaliq, T. B. M. J. Ouarda (2007), On the critical values of the standard normal homogeneity test (SNHT), International Journal of Climatology 27, 681--687.
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.
# NOT RUN {
data(Nile)
(out <- snh.test(Nile))
plot(out)
data(PagesData) ; snh.test(PagesData)
# }
Run the code above in your browser using DataLab