rolling_trends: Rolling trend plots

Description Usage Arguments Value Examples

Description

Demonstrates a distortion of the overall trend as a consequence of the leveraging effect of opening and closing of monitoring sites with different magnitudes over the period examined using rolling trend plots.

Usage

1
2
3
rolling_trends(obs, pollutant, window.width = c(2, 3, 5, 7, 10, 12, 15),
  avg.ts = "year", stat = "median", start.date = "2000-01-01",
  end.date = "2017-12-31", parallel = FALSE, verbose = FALSE)

Arguments

obs

A data frame of ambient pollutant concentration data. Must contain the columns: site_code, date, value. If 'pollutant' is a pollutant ratio, the data frames of the corresponding pollutants must be supplied as a list of data frames in the order they are given in the ratio. E.g. for pollutant = "no2/nox", obs = list(obs.no2, obs.nox).

pollutant

The pollutant of interest (character string). To calculate rolling change trend for a pollutant ratio, separate the two pollutants with a forward slash e.g. pollutant = "no2/nox".

window.width

The width of the moving window, n, over which the change in concentration is calculated (in years). This can be a vector (to compare rolling and average trends over a range of window widths) or a numeric (to return the rolling trend for a single window width).

avg.ts

The resolution to which to average each time series, upon which the rolling regression is carried out. For example, setting avg.ts = "day" means the rolling regression will be carried out on the daily average concentrations from each time series (monitoring site). Options are: "year", "month", "week", and "day".

stat

The metric (character string) used to average the ambient concentration data by year. Options: "median", "mean".

start.date, end.date

The starting and ending dates (character string) of the period of interest over which to calculate and plot the change trend.

parallel

Logical indicating whether the rolling changes should be computed in parallel. If TRUE, the parallelisation will be implemented using the foreach function. The number of cores used will be the total number of cores - 1.

Value

A plot (or, if window.width is a vector, a list of plots labelled by the value of the window width) of the rolling trends (left) and the average trend across the same data as was used in the rolling trends (i.e. filtered by the window.width) (right).

Examples

1
2
3
4
5
6
7
## Not run: 
rolling_trends(london_nox_data, pollutant = "nox",
window.width = c(2, 5, 7, 10), stat = "median",
start.date = "2000-01-01", end.date = "2017-12-31",
parallel = FALSE)

## End(Not run)

pollylang/aqtrends documentation built on May 20, 2019, 8:24 p.m.