mannKen {wql} | R Documentation |
Mann-Kendall trend test and the Sen slope
Description
Applies Kendall's tau test for the significance of a monotonic time series trend (Mann 1945). Also calculates the Sen slope as an estimate of this trend.
Usage
mannKen(
x,
plot = FALSE,
type = c("slope", "relative"),
order = FALSE,
pval = 0.05,
pchs = c(19, 21),
...
)
Arguments
x |
A numeric vector, matrix or data frame |
plot |
Should the trends be plotted when x is a matrix or data frame? |
type |
Type of trend to be plotted, actual or relative |
order |
Should the plotted trends be ordered by size? |
pval |
p-value for significance |
pchs |
Plot symbols for significant and not significant trend estimates, respectively |
... |
Other arguments to pass to plotting function |
Details
The Sen slope (alternately, Theil or Theil-Sen slope)—the median slope joining all pairs of observations—is expressed by quantity per unit time. The fraction of missing slopes involving the first and last fifths of the data are provided so that the appropriateness of the slope estimate can be assessed and results flagged. Schertz et al. [1991] discuss this and related decisions about missing data. Other results are used for further analysis by other functions. Serial correlation is ignored, so the interval between points should be long enough to avoid strong serial correlation.
For the relative slope, the slope joining each pair of observations is
divided by the first of the pair before the overall median is taken. The
relative slope makes sense only as long as the measurement scale is
non-negative (not, e.g., temperature on the Celsius scale). Comparing
relative slopes is useful when the variables in x
have different
units.
If plot = TRUE
, then either the Sen slope (type = "slope"
) or
the relative Sen slope (type = "relative"
) are plotted. The plot
symbols indicate, respectively, that the trend is significant or not
significant. The plot can be customized by passing any arguments used by
dotchart
such as xlab
or xlim
, as well as
graphical parameters described in par
.
Value
A list of the following if x
is a vector:
sen.slope |
Sen slope |
sen.slope.rel |
Relative Sen slope |
p.value |
Significance of slope |
S |
Kendall's S |
varS |
Variance of S |
miss |
Fraction of missing slopes connecting
first and last fifths of |
or a matrix with corresponding columns if
x
is a matrix or data frame.
Note
Approximate p-values with corrections for ties and continuity are used
if n > 10
or if there are any ties. Otherwise, exact p-values based on
Table B8 of Helsel and Hirsch (2002) are used. In the latter case, p =
0.0001
should be interpreted as p < 0.0002
.
Author(s)
Alan Jassby, James Cloern
References
Mann, H.B. (1945) Nonparametric tests against trend. Econometrica 13, 245–259.
Helsel, D.R. and Hirsch, R.M. (2002) Statistical methods in water resources. Techniques of Water Resources Investigations, Book 4, chapter A3. U.S. Geological Survey. 522 pages. doi: 10.3133/twri04A3
Schertz, T.L., Alexander, R.B., and Ohe, D.J. (1991) The computer program EStimate TREND (ESTREND), a system for the detection of trends in water-quality data. Water-Resources Investigations Report 91-4040, U.S. Geological Survey.
See Also
Examples
tsp(Nile) # an annual time series
mannKen(Nile)
y <- sfbayChla
y1 <- interpTs(y, gap=1) # interpolate single-month gaps only
y2 <- aggregate(y1, 1, mean, na.rm=FALSE)
mannKen(y2)
mannKen(y2, plot=TRUE) # missing data means missing trend estimates
mannKen(y2, plot=TRUE, xlim = c(0.1, 0.25))
mannKen(y2, plot=TRUE, type='relative', order = TRUE, pval = .001,
xlab = "Relative trend")
legend("topleft", legend = "p < 0.001", pch = 19, bty="n")