Skip to contents

predict_forecast_data() generates a prediction vector from a forecast object and full data frame, putting this prediction back into the data frame.

Usage

predict_forecast_data(
  df,
  forecast_obj,
  sort_col,
  sort_descending,
  pred_col,
  pred_upper_col,
  pred_lower_col
)

Arguments

df

Data frame of model data.

forecast_obj

Object of class forecast that is output from the forecast:: family of functions.

sort_col

Column name(s) to use to dplyr::arrange() the data prior to supplying type and calculating mean absolute scaled error on data involving time series. If NULL, not used. Defaults to "year".

sort_descending

Logical value on whether the sorted values from sort_col should be sorted in descending order. Defaults to FALSE.

pred_col

Column name to store predicted value.

pred_upper_col

Column name to store upper bound of confidence interval generated by the predict_... function. This stores the full set of generated values for the upper bound.

pred_lower_col

Column name to store lower bound of confidence interval generated by the predict_... function. This stores the full set of generated values for the lower bound.

Value

A data frame.