View source: R/trajectory-embedding.R
| trajectory_reframer | R Documentation |
Creates cumulative scaled lag or lead trajectory features for a single time
series. For a backward trajectory, horizon h at time t is
x[t] / x[t - h] - 1. For a forward trajectory, horizon h is
x[t + h] / x[t] - 1.
trajectory_reframer(ts, k, mode = c("backward", "forward"), ts_name = NULL)
ts |
A numeric vector or time-series-like object. |
k |
Positive integer number of lag or lead horizons to create. |
mode |
Direction of the trajectory. |
ts_name |
Optional name used as the prefix for output columns. |
An object of class trajectory_reframer, represented as a list with
trajectory, ts, k, and mode.
x <- c(100, 102, 105, 103, 108)
traj <- trajectory_reframer(x, k = 2, mode = "backward", ts_name = "price")
head(traj$trajectory)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.