seasonTrend | R Documentation |
Finds the trend for each season and each variable in a time series.
seasonTrend(x, plot = FALSE, type = c("slope", "relative"), pval = 0.05, ...)
x |
Time series vector, or time series matrix with column names |
plot |
Should the results be plotted? |
type |
Type of trend to be plotted, actual or relative to series median |
pval |
p-value for significance |
... |
Further options to pass to plotting function |
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.
A data frame with the following fields:
series |
series names |
season |
season number |
sen.slope |
Sen slope in original units per year |
sen.slope.rel |
Sen slope divided by median for that specific season and series |
p |
p-value for the trend according to the Mann-Kendall test. |
missing |
Proportion of slopes joining first and last fifths of the data that are missing |
Alan Jassby, James Cloern
mannKen
, plotSeason
,
facet_wrap
x <- sfbayChla
seasonTrend(x)
seasonTrend(x, plot = TRUE, ncol = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.