standardize2: Standardize a Vector

Description Usage Arguments Details Value References Examples

View source: R/standardize.R

Description

Standardize a Vector

Usage

1
2
3

Arguments

x

numeric vector

scale

scale variable by (twice) its standard deviation?

Details

standardize centers values and scales them by their standard deviation. standardize2 does the same but scales by twice their standard deviation.

Value

standardized vector.

References

Gelman, A. (2008). Scaling Regression Inputs by Dividing by two Standard Deviations. Statistics in Medicine 27(2865–2873).

Examples

1
2
3
4
5
6
 x <- runif(100, 0, 1.2)
 xz <- standardize2(x)
 sd(xz)
 
 xz <- standardize(x)
 sd(xz)

sumtxt/datatools documentation built on Jan. 3, 2021, 1:39 a.m.