tsdecomp: Time Scale Decomposition

View source: R/decompose.R

tsdecompR Documentation

Time Scale Decomposition

Description

Decompose a vector into frequency components

Usage

tsdecomp(x, breaks)

Arguments

x

a numeric vector with no missing data

breaks

a numeric constant or a vector of break points into which x should be broken. If breaks is a constant then x will be broken into that number of frequncies. This argument is passed directly to cut to determine the break points. See cut for more details.

Value

A matrix with dimension n x m where n is the length of x and m is the number of break categories.

Author(s)

Original by Aidan McDermott; revised by Roger Peng rpeng@jhsph.edu

References

Dominici FD, McDermott A, Zeger SL, Samet JM (2003). “Airborne particulate matter and mortality: Timescale effects in four US cities”, American Journal of Epidemiology, 157 (12), 1055–1065.

Examples

x <- rnorm(101)
freq.x <- tsdecomp(x, c(1, 10, 30, 80))

## decompose x into 3 frequency categories.
## x[,1] represents from 1 to 9 cycles in 101 data points
## x[,2] represents from 10 to 29 cycles in 101 data points
## x[,3] represents from 30 to 50 cycles in 101 data points
## you can only have up to 50 cycles in 101 data points.


rdpeng/tsmodel documentation built on May 18, 2022, 5:52 a.m.