Perform a arcsinh(x) transformation

arcsinh_x(x, standardize = TRUE, ...)

# S3 method for arcsinh_x
predict(object, newdata = NULL, inverse = FALSE, ...)

# S3 method for arcsinh_x
print(x, ...)

Arguments

x

A vector to normalize with with x

standardize

If TRUE, the transformed values are also centered and scaled, such that the transformation attempts a standard normal

...

additional arguments

object

an object of class 'arcsinh_x'

newdata

a vector of data to be (potentially reverse) transformed

inverse

if TRUE, performs reverse transformation

Value

A list of class arcsinh_x with elements

x.t

transformed original data

x

original data

mean

mean after transformation but prior to standardization

sd

sd after transformation but prior to standardization

n

number of nonmissing observations

norm_stat

Pearson's P / degrees of freedom

standardize

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.

Details

arcsinh_x performs an arcsinh 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 function is explicitly: log(x + sqrt(x^2 + 1))

Examples

x <- rgamma(100, 1, 1)

arcsinh_x_obj <- arcsinh_x(x)
arcsinh_x_obj
#> Standardized asinh(x) Transformation with 100 nonmissing obs.:
#>  Relevant statistics:
#>  - mean (before standardization) = 0.7198804 
#>  - sd (before standardization) = 0.5443389 
p <- predict(arcsinh_x_obj)
x2 <- predict(arcsinh_x_obj, newdata = p, inverse = TRUE)

all.equal(x2, x)
#> [1] TRUE