ModelTerms | R Documentation |
Tools for creating model/formula terms in time series models
Lag(v, k, group = NULL)
runMean(v, lags = 0, group = NULL, filter = NULL)
harmonic(x, nfreq, period, intercept = FALSE)
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? |
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.
Roger D. Peng
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.