Learn R Programming

TSPred (version 5.1)

minmax: Minmax Data Normalization

Description

The minmax() function normalizes data of the provided time series to bring values into the range [0,1]. minmax.rev() reverses the normalization.

Usage

minmax(data, max = NULL, min = NULL, byRow = FALSE)

minmax.rev(data, max, min)

Arguments

data

A numeric vector, a univariate time series containing the values to be normalized, or a matrix with sliding windows as returned by sw.

max

Integer indicating the maximal value in data, or a vector with the maximal values of each row (sliding window) in data. If NULL it is automatically computed.

min

Integer indicating the minimum value in data, or a vector with the minimum values of each row (sliding window) in data. If NULL it is automatically computed.

byRow

If TRUE, the normalization is performed by rows (sliding windows). Default set to FALSE.

Value

data normalized between 0 and 1. If byRow is TRUE, the function returns data normalized by rows (sliding windows). max and min are returned as attributes.

Details

Ranging is done by using: $$X' = \frac{(x - x_{min})}{(x_{max} - x_{min})}$$.

References

R.J. Hyndman and G. Athanasopoulos, 2013, Forecasting: principles and practice. OTexts.

E. Ogasawara, L. C. Martinez, D. De Oliveira, G. Zimbrao, G. L. Pappa, and M. Mattoso, 2010, Adaptive Normalization: A novel data normalization approach for non-stationary time series, Proceedings of the International Joint Conference on Neural Networks.

See Also

Other normalization methods: an()

Examples

Run this code
# NOT RUN {
data(CATS)
d <- minmax(CATS[,1])
x <- minmax.rev(d, max = attributes(d)$max, min = attributes(d)$min)
all(round(x,4)==round(CATS[,1],4))

d <- minmax(sw(CATS[,1],5), byRow = TRUE)
x <- minmax.rev(d, max = attributes(d)$max, min = attributes(d)$min)
all(round(x,4)==round(sw(CATS[,1],5),4))

# }

Run the code above in your browser using DataLab