Learn R Programming

rEDM (version 2.0.2)

Embed: Time-delay embedding

Description

Takens time-delay embedding of one or more columns, returned as a named data.frame matching pyEDM's Embed().

Usage

Embed(dataFrame = NULL, E = 0, tau = -1, columns = "",
      includeTime = FALSE, pathIn = "./", dataFile = "")

Value

A data.frame of the embedding (with the time column first when includeTime = TRUE).

Arguments

dataFrame

A data.frame of input data. Column 1 is the time vector.

E

Embedding dimension.

tau

Embedding delay in time-column rows (negative selects past lags).

columns

Column name(s) to embed: a whitespace-separated string, or a character vector of column names.

includeTime

If TRUE, prepend column 1 of dataFrame (the time vector), keeping its original name, as the first output column.

pathIn

Directory for dataFile (used when reading input from disk).

dataFile

CSV file name to read as input; when set it takes precedence over dataFrame.

Details

Each columns item produces E lagged vectors. For column c and step i = 0..E-1 the lag is i * |tau|, and the column is named c(t-lag) when tau < 0 or c(t+lag) when tau > 0. For example columns X, Y with E = 2, tau = -1 yield X(t-0) X(t-1) Y(t-0) Y(t-1); with tau = -2 they yield X(t-0) X(t-2) Y(t-0) Y(t-2).

If dataFile is supplied the CSV at file.path(pathIn, dataFile) is read (preserving column names) and used as the input, taking precedence over dataFrame.

All rows are retained; the first |tau| * (E-1) partial rows contain NA.

Examples

Run this code
Embed(data.frame(x = 1:10), E = 3, tau = -1, columns = "x")

Run the code above in your browser using DataLab