Learn R Programming

tspredit (version 1.2.747)

ts_projection: Time Series Projection

Description

Split a ts_data (sliding windows) into input features and output targets for modeling.

Usage

ts_projection(ts)

Value

A ts_projection object with two elements: $input and $output.

Arguments

ts

Matrix or data.frame containing a ts_data representation.

Details

For a multi-column ts_data, returns all but the last column as inputs and the last column as the output. For a single-row matrix, returns ts_data-wrapped inputs/outputs preserving names and window size.

Examples

Run this code
# Setting up a ts_data and projecting (X, y)
# Load example dataset and create windows
data(tsd)
ts <- ts_data(tsd$y, 10)

io <- ts_projection(ts)

# Input data (features)
ts_head(io$input)

# Output data (target)
ts_head(io$output)

Run the code above in your browser using DataLab