modelTerms: Model terms for time series models

Description Usage Arguments Value Author(s) Examples

Description

Tools for creating model/formula terms in time series models

Usage

1
2
3
Lag(v, k, group = NULL)
runMean(v, lags = 0, group = NULL, filter = NULL)
harmonic(x, nfreq, period, intercept = FALSE)

Arguments

v,x

a numeric vector

k,lags

an integer vector giving lag numbers

group

a factor or a list of factors defining groups of observations

filter

a vector specifying a linear filter

nfreq

number of sine/cosine pairs to include

period

period

intercept

should basis matrix include a column of 1s?

Value

Lag returns a length(v) by length(k) matrix of lagged variables. runMean returns a numeric vector of length length(v). harmonic returns a matrix of sine/cosine basis functions.

Author(s)

Roger D. Peng

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Ten day "time series"
x <- rnorm(10)

## Lag 1 of `x'
Lag(x, 1)

## Lag 0, 1, and 2 of `x'
Lag(x, 0:2)

## Running mean of lag 0, 1, and 2
runMean(x, 0:2)

rdpeng/tsmodel documentation built on March 19, 2018, 9:12 a.m.