hai_scale_zscore_vec: Vector Function Scale to Zero and One

View source: R/vec-hai-scale-zscore.R

hai_scale_zscore_vecR Documentation

Vector Function Scale to Zero and One

Description

Takes a numeric vector and will return a vector that has been scaled from by mean and standard deviation

Usage

hai_scale_zscore_vec(.x)

Arguments

.x

A numeric vector to be scaled by mean and standard deviation inclusive.

Details

Takes a numeric vector and will return a vector that has been scaled from mean and standard deviation.

The input vector must be numeric. The computation is fairly straightforward. This may be helpful when trying to compare the distributions of data where a distribution like beta from the fitdistrplus package which requires data to be between 0 and 1

y[h] = (x - mean(x) / sd(x))

This function can be used on it's own. It is also the basis for the function hai_scale_zscore_augment().

Value

A numeric vector

Author(s)

Steven P. Sanderson II, MPH

See Also

Other Vector Function: hai_fourier_discrete_vec(), hai_fourier_vec(), hai_hyperbolic_vec(), hai_kurtosis_vec(), hai_scale_zero_one_vec(), hai_skewness_vec(), hai_winsorized_move_vec(), hai_winsorized_truncate_vec()

Other Scale: hai_scale_zero_one_augment(), hai_scale_zero_one_vec(), hai_scale_zscore_augment(), step_hai_scale_zscore()

Examples

vec_1 <- mtcars$mpg
vec_2 <- hai_scale_zscore_vec(vec_1)

ax <- pretty(min(vec_1, vec_2):max(vec_1, vec_2), n = 12)

hist(vec_1, breaks = ax, col = "blue")
hist(vec_2, breaks = ax, col = "red", add = TRUE)


healthyR.ai documentation built on April 3, 2023, 5:24 p.m.