
Last chance! 50% off unlimited learning
Sale ends in
Perform a log_b (x+a) normalization transformation
log_x(x, a = NULL, b = 10, standardize = TRUE, eps = 0.001, warn = TRUE, ...)# S3 method for log_x
predict(object, newdata = NULL, inverse = FALSE, ...)
# S3 method for log_x
print(x, ...)
A list of class log_x
with elements
transformed original data
original data
mean after transformation but prior to standardization
sd after transformation but prior to standardization
estimated a value
estimated base b value
number of nonmissing observations
Pearson's P / degrees of freedom
was the transformation standardized
The predict
function returns the numeric value of the transformation
performed on new data, and allows for the inverse transformation as well.
A vector to normalize with with x
The constant to add to x (defaults to max(0, -min(x) + eps));
see bestLogConstant
The base of the log (defaults to 10)
If TRUE, the transformed values are also centered and scaled, such that the transformation attempts a standard normal
The allowed error in the expression for the selected a
Should a warning result from infinite values?
additional arguments
an object of class 'log_x'
a vector of data to be (potentially reverse) transformed
if TRUE, performs reverse transformation
log_x
performs a simple log transformation in the context of
bestNormalize, such that it creates a transformation that can be estimated
and applied to new data via the predict
function. The parameter a is
essentially estimated by the training set by default (estimated as the minimum
possible to some extent epsilon), while the base must be
specified beforehand.
x <- rgamma(100, 1, 1)
log_x_obj <- log_x(x)
log_x_obj
p <- predict(log_x_obj)
x2 <- predict(log_x_obj, newdata = p, inverse = TRUE)
all.equal(x2, x)
Run the code above in your browser using DataLab