Suitable for extension packages to create new decompositions for fable.

new_decomposition_class(method = "Unknown model",
  train = function(.data, formula, specials, ...)
  abort("This decomposition has not defined a training method."),
  specials = new_specials(), check = function(.data) {     if
  (NROW(.data) == 0)          abort("There is no data to decompose!") },
  prepare = function(...) { }, ..., .env = caller_env(),
  .inherit = decomposition_definition)

Arguments

method

The name of the decomposition method

train

A function that trains the model to a dataset. .data is a tsibble containing the data's index and response variables only. formula is the user's provided formula. specials is the evaluated specials used in the formula.

specials

Special functions produced using new_specials()

check

A function that is used to check the data for suitability with the model. This can be used to check for missing values (both implicit and explicit), regularity of observations, ordered time index, and univariate responses.

prepare

This allows you to modify the model class according to user inputs. ... is the arguments passed to new_model_definition, allowing you to perform different checks or training procedures according to different user inputs.

...

Further arguments to R6::R6Class(). This can be useful to set up additional elements used in the other functions. For example, to use common_xregs, an origin element in the model is used to store the origin for trend() and fourier() specials. To use these specials, you must add an origin element to the object (say with origin = NULL).

.env

The environment from which functions should inherit from.

.inherit

A model class to inherit from.

Details

This function produces a new R6 decomposition definition. An understanding of R6 is not required, however could be useful to provide more sophisticated model interfaces. All functions have access to self, allowing the functions for training the model and evaluating specials to access the model class itself. This can be useful to obtain elements set in the