prep {predtoolsTS} | R Documentation |
Automatic pre-preprocessing
Description
This function performs pre-processing on a time series object(ts) to treat heterocedasticity, trend and seasonality in order to make the serie stationary.
Usage
prep(tserie, homogenize.method = "log", detrend.method = "differencing",
nd = NULL, deseason.method = "differencing", nsd = NULL,
detrend.first = TRUE)
Arguments
tserie |
A ts object. |
homogenize.method |
A string. Current methods available are "log" and "boxcox". Method "log" is set as default. If you don't want to perform this transformation, set method as "none". |
detrend.method |
A string. Current methods available are "differencing" and "sfsm". Method "differencing" is set as default. If you don't want to perform this transformation, set method as "none". |
nd |
A number. Number of differences you want to apply to the "differencing" detrending method. As default its value is NULL, which means nd will be calculated internally. |
deseason.method |
A string. Current methods available are "differencing". Method "differencing" is set as default. If you don't want to perform this transformation, set method as "none". |
nsd |
A number. Number of seasonal differences you want to apply to the "differencing" deseasoning method. As default its value is NULL, which means nsd will be calculated internally. |
detrend.first |
A boolean. TRUE if detrending method is applied first, then deseasoning. FALSE if deseasoning method is applied first. Default is TRUE. |
Details
Returns an object prep
which stores all data needed to undo the changes later on.
This function provides an automatic way of pre-processing based on unit root tests, but this is not the perfect way to do it. You should always check manually if the given time serie is actually stationary, and modify the parameters according to your thoughts.
Value
A list is returned of class prep
containing:
tserie |
Processed ts object. |
homogenize.method |
Method used for homogenizing. |
detrend.method |
Method used for detrending. |
nd |
Number of differences used on detrending through differencing. |
firstvalues |
First |
deseason.method |
Method used for deseasoning. |
nsd |
Number of seasonal differences used on deseasoning through differencing. |
firstseasons |
First |
detrend.first |
Processed ts object |
means |
Vector of means used in "sfsm" detrending method. |
lambda |
Coefficient used in "boxcox" transformation. |
start |
Start of the original time serie. |
length |
Length of the original time serie. |
Author(s)
Alberto Vico Moreno
References
https://www.otexts.org/fpp/8/1
See Also
prep.homogenize.log
,
prep.homogenize.boxcox
,
prep.detrend.differencing
,
prep.detrend.sfsm
,
prep.deseason.differencing
,
prep.check.acf
,
prep.check.adf
Examples
prep(AirPassengers)
prep(AirPassengers,homogenize.method='boxcox',detrend.method='none')