View source: R/partial.mk.test.R
partial.mk.test | R Documentation |
Performs a partial Mann-Kendall Trend Test
partial.mk.test(x, y, alternative = c("two.sided", "greater", "less"))
x |
a "vector" or "ts" object that contains the variable, which is tested for trend (i.e. correlated with time) |
y |
a "vector" or "ts" object that contains the variable, which effect on "x" is partialled out |
alternative |
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
A list with class "htest"
method |
a character string indicating the chosen test |
data.name |
a character string giving the name(s) of the data |
statistic |
the value of the test statistic |
estimate |
the Mann-Kendall score S, the variance varS and the correlation between x and y |
alternative |
a character string describing the alternative hypothesis |
p.value |
the p-value of the test |
null.value |
the null hypothesis |
Current Version is for complete observations only. The test statistic is not corrected for ties.
Libiseller, C. and Grimvall, A., (2002). Performance of partial Mann-Kendall tests for trend detection in the presence of covariates. Environmetrics 13, 71–84, \Sexpr[results=rd]{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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.