Finds the trend for each season and each variable in a time series.
seasonTrend(x, plot = FALSE, type = c("slope", "relative"), pval = 0.05, ...)A data frame with the following fields:
series names
season number
Sen slope in original units per year
Sen slope divided by median for that specific season and series
p-value for the trend according to the Mann-Kendall test.
Proportion of slopes joining first and last fifths of the data that are missing
Time series vector, or time series matrix with column names
Should the results be plotted?
Type of trend to be plotted, actual or relative to series median
p-value for significance
Further options to pass to plotting function
Alan Jassby, James Cloern
The Mann-Kendall test is applied for each season and series (in the case of
a matrix). The actual and relative Sen slope (actual divided by median for
that specific season and series); the p-value for the trend; and the
fraction of missing slopes involving the first and last fifths of the data
are calculated (see mannKen).
If plot = TRUE, each season for each series is represented by a bar
showing the trend. The fill colour indicates whether \(p < 0.05\) or not.
If the fraction of missing slopes is 0.5 or more, the corresponding trends
are omitted.
Parameters can be passed to the plotting function, in particular, to
facet_wrap in ggplot2. The most useful parameters here are
ncol (or nrow), which determines the number of columns (or
rows) of plots, and scales, which can be set to "free_y" to
allow the y-axis to change for each time series. Like all ggplot2
objects, the plot output can also be customized extensively by modifying and
adding layers.
mannKen, plotSeason,
facet_wrap
x <- sfbayChla
seasonTrend(x)
seasonTrend(x, plot = TRUE, ncol = 4)
Run the code above in your browser using DataLab