Learn R Programming

wq (version 0.4.6)

mannKen: 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 = .05, pchs = c(19, 21), ...)

Arguments

Value

A list of the following if x is a vector:sen.slopeSen slopesen.slope.relSen slope divided by medianp.valueSignificance of slopeSKendall's SvarSVariance of SmissFraction of missing slopes connecting first and last fifths of xor a matrix with corresponding columns if x is a matrix or data frame.

Rdversion

1.1

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 and by the same value divided by the series median. 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. The relative slope makes sense only as long as the measurement scale is strictly non-negative and the median is not zero (not, e.g., temperature on the Celsius scale). Serial correlation is ignored, so the interval between points should be long enough to avoid strong serial correlation.

If plot = TRUE, then either the Sen slope (type = "slope") or the relative Sen slope (type = "relative") are plotted. Plotting the relative slope is useful when the variables in x have different units. 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.

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. http://pubs.usgs.gov/twri/twri4a3/

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

seaKen, seasonTrend, tsSub

Examples

Run this code
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)
mannKen(y2, plot=TRUE, type='relative', order = TRUE, pval = .001,
  xlab = "Relative trend")
legend("topleft", legend = "p < 0.05", pch = 19, bty="n")

Run the code above in your browser using DataLab