lagdata: Creating single lagged and moving average variables

Description Usage Arguments Details Value Author(s) References Examples

View source: R/lagdata.R

Description

Function lagdata creates single lagged and moving average variables of the lag number that the user designate.

Usage

1
lagdata(data, varlist, laglength)

Arguments

data

Data includes lagged variables.

varlist

List of variables to be lagged.

laglength

Number of lag days.

Details

Certain exposure on the previous days has an effect on the event on now day. This effect is referred to as the lagged effects. Studies wanting to estimate lagged effects would include the exposure value for previous days in the time series model, and those wanting to estimate cumulative effect of the same day and the previous days would include the moving average value of the exposure.

Value

lagdata gives single lagged variables (varname_sxx, xx indicates lag length) and moving average variables (varname_mxx).

Author(s)

Youn-Hee Lim, Il-Sang Ohn, and Ho Kim

References

Dominici F. Time-series analysis of air pollution and mortality: a statistical review. Research report (Health Effects Institute), (123):3, 2004.
Gasparrini A and Armstrong B. Time series analysis on the health effects of temperature: advancements and limitations. Environmental research, 110(6):633-638, 2010.

Examples

1
2
3
4
5
6
# read the data
data(mort)
seoul = read6city(mort, 11)

# create lagged and moving average variables
seoul_lag = lagdata(seoul, c("meantemp", "mintemp", "meanpm10", "meanhumi"), 5)

Example output

Loading required package: splines

HEAT documentation built on May 29, 2017, 10:52 a.m.

Related to lagdata in HEAT...