standardize2: Standardize a Vector

Description Usage Arguments Details Value References Examples

View source: R/standardize2.R

Description

Standardize a Vector

Usage

1

Arguments

x

numeric vector

scale

scale variable by twice its standard deviation?

Details

The function mean-centers values in the vector and scale them by twice their standard deviation. The function ignores all missing values.

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
7
8
 ## Not run: 

 x <- runif(100, 0, 1.2)
 xz <- standardize2(x)
 sd(xz)
 
 
## End(Not run)

sumtxt/datatools documentation built on Oct. 7, 2018, 11:18 p.m.