etalonnage: etalonnage

View source: R/etalonnage.R

etalonnageR Documentation

etalonnage

Description

To train and evaluate the models, a rolling-origin-update evaluation (ROUE) is implemented, meaning that the forecast origin rolls ahead in time. At each step, ROUE increments the traning set by one observation of the test set. The date of the first sample to predict is given by forecast_origin plus 1 quarter. Note that the training set always starts at the first sample of X. To take into account the non-synchronicity of data publications, use the extend argument to indicate which series need to be extended. This way the forecast accuracy can be assessed on the basis of a pseudo real-time experiment i.e. replicating the timeliness of the releases of the series by taking into account their publication lags. This ensures to consider only those values of the series that would have been available on the date on which the forecasts were calculated.

Usage

etalonnage(
  X,
  y,
  forecast_origin,
  name = NULL,
  regressor = c("randomForest", "xgboost", "glmnet", "lm"),
  extend = NULL,
  extend_mode = c("ARIMA", "constant"),
  scale = c("none", "center", "scale"),
  frequency = "quarter",
  seed = 313,
  ...
)

Arguments

X

A tibble/df containing the regressors at a quarterly frequency. Must contain a date column.

y

A vector containing the target variable.

forecast_origin

A character indicating the first forecast origin, it must be of the form "YYYY-MM-01".

name

A character indicating a name for the analysis - if missing defaults to NULL.

regressor

A character. For now, only "randomForest", "xgboost" "glmnet" and "lm" are accepted.

extend

A list of 2 elements. The 1st one contains a vector of characters indicating columns to extend when fitting models, the 2nd one contains a vector indicating the number of samples to remove and predict for each column - if missing defaults to NULL.

extend_mode

Indicates whether to extend columns in extend_cols[[1]] using an ARMA(p,d,q) model or by replacing missing values with the last observed value. Must be one of "ARIMA" or "constant".

scale

Indicates whether to leave unchanged, center or scale X. Must be one of "none, "center" or "scale".

frequency

A character indicating the date frequency - if missing defaults to "quarter".

seed

A numeric value interpreted as an integer.

...

Aditionnal arguments to pass to the regressor.

Value

An object from S3 class etalonnage.


aflatoune/approche-directe documentation built on May 30, 2022, 1:56 p.m.