Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

embed2

Improved embed() function


Description

Improved version of the embed function in the stats package. First it allows embeddings in past and future observation space (backward and forward shift). Secondly, it adds 'NA' to the beginning (or end) of the embedding matrix, depending on the dimension of the embedding. Optionally, they can be removed.

Usage

embed2(x, max.lag = 1, na.omit = FALSE)

Arguments

x

a numeric vector, matrix, or time series.

max.lag

a scalar representing the embedding dimension in past or future. Note that contrary to 'dimension = 1' in embed, here 'max.lag = 1' will return a 2 column matrix (0 lag, 1 lag), and not just a 1 column matrix. Similarly, for negative shift; e.g., 'max.lag = -2' returns 3 column matrix with (0 lag, -1 lag, -2 lag).

na.omit

logical; if TRUE, it removes NA values automatically from embedded matrix.

See Also

Examples

data(nottem)
aa <- embed2(nottem, 12)

LICORS

Light Cone Reconstruction of States - Predictive State Estimation From Spatio-Temporal Data

v0.2.0
GPL-2
Authors
Georg M. Goerg <gmg@stat.cmu.edu>
Initial release
2013-11-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.