rolling_change_trend: Rolling change trends (extract true trend)

Description Usage Arguments Value Examples

Description

Removal of distorting effect of site movement to reveal underlying trend by using changes in concentration as a function of year as a proxy for the average trend. This method retains information about the shape of the trend, while ignoring differences in magnitude, thus removing the leveraging effect of opening and closing sites with extreme magnitudes.

Usage

1
2
3
rolling_change_trend(obs, pollutant, window.width, 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).

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.

verbose

Logical indicating whether to print the date range of the rolling window over which the calculation is being applied.

Value

A plot of the rolling change trend.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
rolling_change_trend(london_nox_data,
pollutant = "nox",
window.width = 3,
avg.ts = "year",
stat = "median",
start.date = "2000-01-01", end.date = "2017-12-31")

## End(Not run)

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