Learn R Programming

wq (version 0.4.3)

mannKen: Mann-Kendall 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", "pct", "tau"), order = FALSE)

Arguments

Value

A list with the following members:sen.slopeSen slope.sen.slope.pctSen slope as percent of mean.p.valueSignificance of slope.SKendall's S.varSVariance of S.missFraction of missing slopes connecting first and last fifths of x.

Rdversion

1.1

Details

The Sen slope (alternately, Theil or Theil-Sen slope)---the median slope joining all pairs of observations---is expressed both by quantity per unit time and percent of the mean 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. Other results are used for further analysis by other functions.

If plot = TRUE, then either the Sen slope, the Sen slope as a percent of the mean, or Kendall's tau are plotted, along with an indication of p-value and fraction of missing slopes joining the first and last fifths of the data. Only the last two types make sense when the variables in x have different units.

References

Mann, H.B. (1945) Nonparametric tests against trend. Econometrica 13, 245--259.

Slack, J.R., Lorenz, D.L., and others (2003) USGS library for S-PLUS for Windows. Open-File Report 03-357, 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='pct')
mannKen(y2, plot=TRUE, type='tau', order=TRUE)

Run the code above in your browser using DataLab