standardize_vec {timetk}R Documentation

Standardize to Mean 0, Standard Deviation 1 (Center & Scale)

Description

Standardization is commonly used to center and scale numeric features to prevent one from dominating in algorithms that require data to be on the same scale.

Usage

standardize_vec(x, mean = NULL, sd = NULL, silent = FALSE)

standardize_inv_vec(x, mean, sd)

Arguments

x

A numeric vector.

mean

The mean used to invert the standardization

sd

The standard deviation used to invert the standardization process.

silent

Whether or not to report the automated mean and sd parameters as a message.

Details

Standardization vs Normalization

Value

Returns a numeric vector with the standardization transformation applied.

See Also

Examples

library(dplyr)

d10_daily <- m4_daily %>% dplyr::filter(id == "D10")

# --- VECTOR ----

value_std <- standardize_vec(d10_daily$value)
value     <- standardize_inv_vec(value_std,
                                 mean = 2261.60682492582,
                                 sd   = 175.603721730477)

# --- MUTATE ----

m4_daily %>%
    group_by(id) %>%
    mutate(value_std = standardize_vec(value))


[Package timetk version 2.9.0 Index]