episodes: Extreme episodes

Description Usage Arguments Value References Examples

View source: R/episodes.R

Description

Extract episodes of extreme above a given threshold, possibly including several days before and after the excess.

Usage

1
2
episodes(x, u, type = c("absolute", "quantile"), trend = NULL, l = 0,
  r = 1, covariates = NULL, uc = NULL)

Arguments

x

Numeric vector containing the data from which the extremes are to be extracted.

u

Numeric value giving the threshold above which values of x are extremes.

type

One of c("absolute","quantile"). If "absolute" (the default), the threshold is the value of u. If "quantile" the threshold is taken as the quantile of order u. In the latter case, u must be between 0 and 1.

trend

Numeric value or vector indicating an optional trend for the threshold. Can be a scalar value for linear trends, or a vector the same length as x for more general trends.

l

Integer. An episode is taken as the day(s) exceeding u as well as the l days before and after the excesses.

r

Positive integer. Number of consecutive values below threshold following an excess to end the episode.

covariates

Numeric matrix. Covariates to for additional contraints on the extracted episodes.

uc

Numeric vector. Thresholds for covariates. Extremes of x are return only if covariates are also above their given thresholds.

Value

A data.frame object containing the indices, values, episode number of all episodes found, and a logical indicating if the day is one of the extremes (useful when l > 0).

In addition, contains the attribute threshold which gives he threshold for each value of x for plotting, as well as r, l and uc that contains values of the corresponding parameters used to extract episodes.

References

Chebana F., Martel B., Gosselin P., Giroux J.X., Ouarda T.B.M.J., 2013. A general and flexible methodology to define thresholds for heat health watch and warning systems, applied to the province of Quebec (Canada). International journal of biometeorology 57, 631-644.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  library(dlnm)
  data(chicagoNMMAPS)
  x <- chicagoNMMAPS$death
  dates <- as.POSIXlt(chicagoNMMAPS$date)
  n <- nrow(chicagoNMMAPS)

  # Compute over-mortality
  om <- excess(x, dates = dates, order = 15)
  
  # Extract all days for which om is above 40%
  epis <- episodes(om, u = 40)
  # Show the corresponding dates
  dates[epis$t]

PierreMasselot/hhws documentation built on May 25, 2019, 4:01 a.m.