Skip to contents

Flat extrapolation

Usage

flat_extrapolation(
  df,
  col,
  group_col = NULL,
  sort_col = "year",
  pred_col = "pred",
  sort_descending = FALSE,
  replace_obs = c("missing", "none")
)

Arguments

df

Data frame of model data

col

Name of column to extrapolate/interpolate.

group_col

Column name(s) of group(s) to use in dplyr::group_by() when supplying type, calculating mean absolute scaled error on data involving time series, and if group_models, then fitting and predicting models too. If NULL, not used. Defaults to "iso3".

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".

pred_col

Column name to store predicted value.

sort_descending

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

replace_obs

Character value specifying how, if at all, observations should be replaced by fitted values. Defaults to replacing only missing values, but can be used to replace all values or none.

Value

a data frame with predicted data,