preprocess.tspred: Preprocess method for 'tspred' objects

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/tspred.r

Description

Performs preprocessing of the time series data contained in a tspred class object based on a particular set of transformation methods. Each transformation method is defined by a processing object in the list contained in the tspred class object.

Usage

1
2
## S3 method for class 'tspred'
preprocess(obj, prep_test = FALSE, ...)

Arguments

obj

An object of class tspred defining a particular time series prediction process.

prep_test

Should the testing set of data be preprocessed as well?

...

Other parameters passed to the method preprocess of the processing objects from obj.

Details

The function preprocess.tspred recursively calls the method preprocess on each processing object contained in obj. The preprocessed time series resulting from each of these calls is used as input to the next call. Thus, the order of the list of processing objects in obj becomes important. Finally, the produced preprocessed time series data are introduced in the structure of the tspred class object in obj.

If any transformation method parameters are computed during preprocessing, they are duly updated in the structure of the tspred class object in obj. This is important not only for provenance and reprodutibility of the prediction process, but it is also crucial for the postprocessing step, since the same parameters must be used for reversing any transformations. Furthermore, if prep_test is TRUE, testing sets are preprocessed with the same parameters saved from preprocessing the training set.

Value

An object of class tspred with updated structure containing preprocessed time series data.

Author(s)

Rebecca Pontes Salles

See Also

[tspred()] for defining a particular time series prediction process, and [LT()] for defining a time series transformation method.

Other preprocess: postprocess.tspred(), subset()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data(CATS)

#Obtaining objects of the processing class
proc1 <- subsetting(test_len=20)
proc2 <- BoxCoxT(lambda=NULL)
proc3 <- WT(level=1, filter="bl14")

#Obtaining objects of the modeling class
modl1 <- ARIMA()

#Obtaining objects of the evaluating class
eval1 <- MSE_eval()

#Defining a time series prediction process
tspred_1 <- tspred(subsetting=proc1,
                   processing=list(BCT=proc2,
                                   WT=proc3),
                   modeling=modl1,
                   evaluating=list(MSE=eval1)
)
summary(tspred_1)

tspred_1 <- subset(tspred_1, data=CATS[3])
tspred_1 <- preprocess(tspred_1,prep_test=FALSE)

TSPred documentation built on Jan. 21, 2021, 5:10 p.m.