Performs a Seasonal Mann-Kendall Trend Test (Hirsch-Slack Test)
smk.test(x, alternative = c("two.sided", "greater", "less"), continuity = TRUE)
An object with class "htest" and "smktest"
character string that denotes the input data
the p-value for the entire series
the z quantile of the standard normal distribution for the entire series
the null hypothesis
the estimates S and varS for the entire series
the alternative hypothesis
character string that denotes the test
numeric vector that contains S scores for each season
numeric vector that contains varS for each season
numeric vector that contains p-values for each season
numeric vector that contains z-quantiles for each season
a time series object with class ts
comprising >= 2 seasons;
NA
values are not allowed
the alternative hypothesis, defaults to two.sided
logical, indicates, whether a continuity correction
should be done; defaults to TRUE
The Mann-Kendall statistic for the $g$-th season is calculated as:
$$ S_g = \sum_{i = 1}^{n-1} \sum_{j = i + 1}^n \mathrm{sgn}\left(x_{jg} - x_{ig}\right), \qquad (1 \le g \le m)$$
with \(\mathrm{sgn}\) the signum function (see sign
).
The mean of \(S_g\) is \(\mu_g = 0\). The variance including the correction term for ties is
$$ \sigma_g^2 = \left\{n \left(n-1\right)\left(2n+5\right) - \sum_{j=1}^p t_{jg}\left(t_{jg} - 1\right)\left(2t_{jg}+5\right) \right\} / 18 ~~ (1 \le g \le m)$$
The seasonal Mann-Kendall statistic for the entire series is calculated according to
$$ \begin{array}{ll} \hat{S} = \sum_{g = 1}^m S_g & \hat{\sigma}_g^2 = \sum_{g = 1}^m \sigma_g^2 \end{array}$$
The statistic \(S_g\) is approximately normally distributed, with
$$z_g = S_g / \sigma_g$$
If continuity = TRUE
then a continuity correction will be employed:
$$z = \mathrm{sgn}(S_g) ~ \left(|S_g| - 1\right) / \sigma_g$$
Hipel, K.W. and McLeod, A.I. (1994), Time Series Modelling of Water Resources and Environmental Systems. New York: Elsevier Science.
Libiseller, C. and Grimvall, A. (2002), Performance of partial Mann-Kendall tests for trend detection in the presence of covariates. Environmetrics 13, 71--84, tools:::Rd_expr_doi("10.1002/env.507").
R. Hirsch, J. Slack, R. Smith (1982), Techniques of Trend Analysis for Monthly Water Quality Data, Water Resources Research 18, 107--121.
res <- smk.test(nottem)
## print method
res
## summary method
summary(res)
Run the code above in your browser using DataLab