scale: Scale a data frame or matrix

Description Usage Arguments Details Value Examples

Description

Scale a data frame or matrix

Usage

1
scale(data, scale.type = "sample.sd")

Arguments

data

a data frame or matrix

scale.type

one of "sample.sd" (default),"pop.sd", "median", "huber", "YJ", or "npn". pop.sd centers by the mean and population standard deviation, while sample.sd uses the R default of the sample standard deviation formula as in base::scale. "median" uses the median as the center and median absolute deviation as the scale. "huber" uses Huber's robust estimates of location and scale (relying on the MASS::hubers function). "YJ" performs the Yeo-Johnson transformation on the numeric variables. This is a generalization of the Box-Cox transformation which allows for transforming variables with negative values. "npn" performs the non-paranormal transform, which in my opinion is preferable to the Yeo-Johnson/Box-Cox transform. The non-paranormal transform takes the rank of each value in a vector X and divides it by the number of samples+1 to obtain a vector Q, ie Q=rank(x)/(n + 1). It then plugs each observation in Q into the normal quantile function and scaled by the standard deviation. This results in a normally distributed, scaled, and centered, data set.

Details

an improvement of the base R scale function. This function takes a data frame or matrix of mixed variable types and scales the numeric columns according to one of several options.

Value

A matrix or data frame

Examples

1

abnormally-distributed/abdisttools documentation built on May 5, 2019, 7:07 a.m.