make_future: Convert forecasts to a future frame

View source: R/make_future.R

make_futureR Documentation

Convert forecasts to a future frame

Description

Convert forecasts from a fable object to a standardized forecast table.

Usage

make_future(fable, context)

Arguments

fable

A fable created with forecast().

context

A named list with the identifiers for series_id, value_id, and index_id.

Details

make_future() converts the output of forecast() into a tibble with a consistent structure for downstream evaluation, plotting, and accuracy calculation.

The returned future_frame contains one row per forecasted observation, time series, split, and model. It includes the following columns:

  • the time index column specified by context$index_id;

  • the series identifier column specified by context$series_id;

  • model: the forecasting model name;

  • split: the train-test split identifier;

  • horizon: the forecast horizon within each series, split, and model;

  • point: the point forecast, taken from the .mean column of the fable.

This format is used by functions such as make_accuracy() and make_errors().

Value

A tibble containing forecasts in standardized future_frame format.

See Also

Other time series cross-validation: make_split(), make_tsibble(), slice_test(), slice_train(), split_index()

Examples

library(dplyr)
library(tsibble)
library(fable)
library(fabletools)

context <- list(
  series_id = "series",
  value_id = "value",
  index_id = "index"
)

main_frame <- M4_monthly_data |>
  filter(series %in% c("M23100", "M14395"))

split_frame <- make_split(
  main_frame = main_frame,
  context = context,
  type = "first",
  value = 120,
  n_ahead = 18,
  n_skip = 17,
  n_lag = 0,
  mode = "stretch",
  exceed = FALSE
)

train_frame <- slice_train(
  main_frame = main_frame,
  split_frame = split_frame,
  context = context
) |>
  as_tsibble(
    index = index,
    key = c(series, split)
  )

model_frame <- train_frame |>
  model(
    "SNAIVE" = SNAIVE(value ~ lag("year"))
  )

fable_frame <- model_frame |>
  forecast(h = 18)

future_frame <- make_future(
  fable = fable_frame,
  context = context
)

future_frame

tscv documentation built on May 13, 2026, 9:07 a.m.