preprocessor: Preprocessor environment

Description Usage Details Value Examples

View source: R/ts_preprocess.R

Description

Can be used to flexibly transforming and backtransforming data. Generally all functions - including custom ones in the current environment are supported. The function assumes that each transformation funcotion (e.g. normalize <- function (x, ...) {}) has a backtransformation function with the same name but a inv_ prefix (e.g. inv_normalize <- function(x, param, ...){}). All parameter used for transforming the variables can be stored in the param variable; which will be passed automatically back to the backtransformation function.

Usage

1

Details

The preprocessor has to "instantiated" and can then be called using the following parameters:

Value

returns either transformed or backtransformed time series vector

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# not run
# load demo data
library(Mcomp)
# get demo time series
demo_ts <- M3[[1560]]$x
# show demo ts
demo_ts
# get preprocessor "object" (environment)
pp <- preprocessor()
# preprocess time series
y_pp <- pp(y = demo_ts,
           action = 'transform',
           operations = c('seasonal_adjustment', 'scale'),
           frequency = frequency(demo_ts))
# show preprocessed time series
y_pp
# ok, now go back to the roots
y_back <- pp(y = y_pp, action = 'backtransform', is_fcs = F)
y_back - demo_ts
# end not run

yvesmauron/univariate-time-series-forecasting documentation built on March 2, 2020, 12:20 a.m.