trajectory_embedding: Build Past and Future Trajectory Matrices

View source: R/trajectory-embedding.R

trajectory_embeddingR Documentation

Build Past and Future Trajectory Matrices

Description

Builds past and future cumulative-trajectory matrices for all columns in a multivariate time-series data set. Rows containing unavailable lag or lead values are removed from the aligned training matrices, while latest_trajectory retains the latest past trajectory row for forecasting.

Usage

trajectory_embedding(ts_set, trajectory_window)

Arguments

ts_set

A data frame or matrix of numeric time series in columns.

trajectory_window

Positive integer number of lag and lead horizons.

Value

A list with past_trajectories, future_trajectories, latest_trajectory, and time_index. The time_index vector indicates rows retained in the aligned past and future trajectory matrices.

Examples

prices <- data.frame(a = c(100, 101, 103, 104, 106), b = c(50, 52, 51, 53, 54))
trajectories <- trajectory_embedding(prices, trajectory_window = 2)
dim(trajectories$past_trajectories)
dim(trajectories$future_trajectories)

CRAFT documentation built on Nov. 2, 2026, 9:06 a.m.