Performs a partial Mann-Kendall Trend Test
partial.mk.test(x, y, alternative = c("two.sided", "greater", "less"))
A list with class "htest"
a character string indicating the chosen test
a character string giving the name(s) of the data
the value of the test statistic
the Mann-Kendall score S, the variance varS and the correlation between x and y
a character string describing the alternative hypothesis
the p-value of the test
the null hypothesis
a "vector" or "ts" object that contains the variable, which is tested for trend (i.e. correlated with time)
a "vector" or "ts" object that contains the variable, which effect on "x" is partialled out
character, the alternative method; defaults to "two.sided"
According to Libiseller and Grimvall (2002), the test statistic
for x
with its covariate y
is
$$ z = \frac{S_x - r_{xy} S_y}{\left[ \left( 1 - r_{xy}^2 \right) n \left(n - 1 \right) \left(2 n + 5 \right) / 18 \right]^{0.5}}$$
where the correlation \(r\) is calculated as:
$$ r_{xy} = \frac{\sigma_{xy}} {n \left(n - 1\right) \left(2 n + 5 \right) / 18} $$
The conditional covariance between \(x\) and \(y\) is
$$ \sigma_{xy} = \frac{1}{3} \left[K + 4 \sum_{j=1}^n R_{jx} R_{jy} - n \left(n + 1 \right) \left(n + 1 \right) \right]$$
with
$$ K = \sum_{1 \le i < j \le n} \mathrm{sgn} \left\{ \left( x_j - x_i \right) \left( y_j - y_i \right) \right\}$$
and
$$ R_{jx} = \left\{ n + 1 + \sum_{i=1}^n \mathrm{sgn} \left( x_j - x_i \right) \right\} / 2$$
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").
partial.cor.trend.test
,
data(maxau)
s <- maxau[,"s"]; Q <- maxau[,"Q"]
partial.mk.test(s,Q)
Run the code above in your browser using DataLab