Learn R Programming

wq (version 0.2-9)

plotSeasonTrend: Plot seasonal trends

Description

Plots the trend for each season of a time series (matrix or vector) and indicates statistical significance.

Usage

plotSeasonTrend(x, first, last, type = c("slope", "slope.pct"), method = c("mk", "lin"), plot = TRUE, miss = FALSE, leg = FALSE, ...)

Arguments

Value

A plot, or a data frame with the following fields:trendTheil-Sen slope in original units per year, or percent per year.pp-value for the trend according to the Mann-Kendall test.missingProportion of slopes joining first and last fifths of the data that are missing.seasonSeason number.tsnameName of time series.

Details

The slope estimate and its significance are calculated for each season and time series. If type = "slope.pct", the slopes are multiplied by 100 and divided by the overall mean (not the median, which can be zero even in cases where a trend estimate is useful). If method = 'mk'. the Theil-Sen slope is calculated with the Mann-Kendall test of significance. Otherwise, linear regression is used to determine the slope and significance. The results can be shown as a listing, or as a graph in which each time series is represented by a dot plot showing the trend for each season. The colour of the dot indicates whether the trend is significant or not. When method = 'mk', the dot shape (solid or empty circle) indicates whether the proportion of slopes joining the first and last fifths of the data is < 0.5 or not. If this value is 0.5 or more, the trend results may not be a good representation of the entire period and a different time window should be considered. Indication of missing values and the graph legend is optional.

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_x" to allow the x-axis to change for each time series.

See Also

mannKen, plotSeason, facet_wrap

Examples

Run this code
x <- sfbayChla
plotSeasonTrend(x, first=1978, last=2009, ncol = 4, scales = 'free_x')
plotSeasonTrend(x, type = 'slope.pct', plot = FALSE)

Run the code above in your browser using DataLab