First reverses scores, then perform a log_b(x) normalization transformation, and then reverses scores again.
A vector to normalize with with x
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 cushion for the transformation range (defaults to 10 percent)
Should a warning result from infinite values?
additional arguments
an object of class 'double_reverse_log'
a vector of data to be (potentially reverse) transformed
if TRUE, performs reverse transformation
A list of class double_reverse_log
with elements
transformed original data
original data
mean after transformation but prior to standardization
sd after transformation but prior to standardization
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.
double_reverse_log
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)
double_reverse_log_obj <- double_reverse_log(x)
double_reverse_log_obj
#> Standardized double reversed Log_b(x + a) Transformation with 100 nonmissing obs.:
#> Relevant statistics:
#> - a =
#> - b = 10
#> - max(x) = 4.303169 ; min(x) = -0.3902701
#> - mean (before standardization) = 0.2146823
#> - sd (before standardization) = 0.199244
p <- predict(double_reverse_log_obj)
x2 <- predict(double_reverse_log_obj, newdata = p, inverse = TRUE)
all.equal(x2, x)
#> [1] TRUE