Learn R Programming

tspredit (version 1.2.747)

ts_norm_diff: First Differences

Description

Transform a series by first differences to remove level and highlight changes; normalization is then applied to the differenced series.

Usage

ts_norm_diff(outliers = outliers_boxplot())

Value

A ts_norm_diff object.

Arguments

outliers

Indicate outliers transformation class. NULL can avoid outliers removal.

References

Salles, R., Assis, L., Guedes, G., Bezerra, E., Porto, F., Ogasawara, E. (2017). A framework for benchmarking machine learning methods using linear models for univariate time series prediction. Proceedings of the International Joint Conference on Neural Networks (IJCNN). doi:10.1109/IJCNN.2017.7966139

Examples

Run this code
# Differencing + global min–max normalization
# Load package and example data
library(daltoolbox)
data(tsd)

# Convert to sliding windows and preview raw last column
ts <- ts_data(tsd$y, 10)
ts_head(ts, 3)
summary(ts[,10])

# Fit differencing preprocessor and transform; note one fewer lag column
preproc <- ts_norm_diff()
preproc <- fit(preproc, ts)
tst <- transform(preproc, ts)
ts_head(tst, 3)
summary(tst[,9])

Run the code above in your browser using DataLab