decompose: Time scale decomposition

Description Usage Arguments Value Author(s) References Examples

Description

Decompose a vector into frequency components

Usage

1
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 [email protected]

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

1
2
3
4
5
6
7
8
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 March 19, 2018, 9:12 a.m.