baseline: Baseline

Description Usage Arguments Details Value References See Also Examples

View source: R/baseline.R

Description

Compute a baseline from a series through two steps: 1) smoothing and 2) calendar mean.

Usage

1
2
baseline(x, dates, nyear = Inf, center = FALSE,
  smoothing.fun = c("ma", "spline", "none"), ...)

Arguments

x

Numeric vector. Contains data from which the baseline is computed.

dates

POSIXt vector the same length as x. Dates corresponding to each element of x. Alternatively, a character vector can be provided as long as it can be coerced to a POSIXt object.

nyear

Integer. Number of years around the current one to consider in the calendar mean step.

center

Logical. Is the calendar mean of step 2 centered on current year? If FALSE (the default), the past nyear are used.

smoothing.fun

One of "ma", "spline" or "none". Type of smoothing to perform on step 1. If "ma" (the default), a moving average is performed using the function ma from the package forecast. If "spline", smooth.spline is used. If "none", no smoothing is performed.

...

Additional arguments to be passed to function chosen in smoothing.fun.

Details

Computes a baseline of expected mortality (or other health issue) to use as a reference to later compute a series of excess mortality. The baseline is computed through two steps:

  1. Smoothing of the series x ;

  2. Computing of a calendar mean, i.e. each day of year of the baseline is the mean of the smoothed series at the same day of year for nyear.

Value

A numeric vector the same length as x.

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.

See Also

excess to compute excesses from the baseline.

Examples

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

  em <- baseline(x, dates, order = 15)
  plot(dates, x)
  lines(dates, em, col = "red")

  em2 <- baseline(x, dates, smoothing.fun = "spline")
  plot(dates, x)
  lines(dates, em2, col = "red")

  em3 <- baseline(x, dates, nyear = 2, order = 15)
  plot(dates, x)
  lines(dates, em3, col = "red")

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