Perform Lambert's W x F transformation and center/scale a vector
to attempt normalization via the LambertW
package.
lambert(x, type = "s", ...)# S3 method for lambert
predict(object, newdata = NULL, inverse = FALSE, ...)
# S3 method for lambert
print(x, ...)
A vector to normalize with Box-Cox
a character indicating which transformation to perform (options are "s", "h", and "hh", see details)
Additional arguments that can be passed to the LambertW::Gaussianize function
an object of class 'lambert'
a vector of data to be (reverse) transformed
if TRUE, performs reverse transformation
A list of class lambert
with elements
transformed original data
original data
mean of vector
sd of vector post-BC transformation
estimated parameters of LambertW::Gaussianize
number of nonmissing observations
Pearson's P / degrees of freedom
lambert
uses the LambertW
package to estimate a
normalizing (or "Gaussianizing") transformation. This transformation can be
performed on new data, and inverted, via the predict
function.
NOTE: The type = "s" argument is the only one that does the 1-1 transform
consistently, and so it is the only method currently used in
bestNormalize()
. Use type = "h" or type = 'hh' at risk of not having
this estimate 1-1 transform. These alternative types are effective when the
data has exceptionally heavy tails, e.g. the Cauchy distribution.
Georg M. Goerg (2016). LambertW: An R package for Lambert W x F Random Variables. R package version 0.6.4.
Georg M. Goerg (2011): Lambert W random variables - a new family of generalized skewed distributions with applications to risk estimation. Annals of Applied Statistics 3(5). 2197-2230.
Georg M. Goerg (2014): The Lambert Way to Gaussianize heavy-tailed data with the inverse of Tukey's h transformation as a special case. The Scientific World Journal.
# NOT RUN {
x <- rgamma(100, 1, 1)
lambert_obj <- lambert(x)
lambert_obj
p <- predict(lambert_obj)
x2 <- predict(lambert_obj, newdata = p, inverse = TRUE)
all.equal(x2, x)
# }
Run the code above in your browser using DataLab