bestLogConstant: Calculate and perform best normalizing log transformation...

View source: R/bestLogConstant.R

bestLogConstantR Documentation

Calculate and perform best normalizing log transformation (experimental)

Description

Similar to bestNormalize, this selects the best candidate constant for a log transformation on the basis of the Pearson P test statistic for normality. The transformation that has the lowest P (calculated on the transformed data) is selected. This function is currently in development and may not behave as expected.

See details for more information.

Usage

bestLogConstant(x, a, standardize = TRUE, ...)

## S3 method for class 'bestLogConstant'
predict(object, newdata = NULL, inverse = FALSE, ...)

## S3 method for class 'bestLogConstant'
print(x, ...)

Arguments

x

A vector to normalize

a

(optional) a list of candidate constants to choose from

standardize

If TRUE, the transformed values are also centered and scaled, such that the transformation attempts a standard normal. This will not change the normality statistic.

...

additional arguments.

object

an object of class 'bestLogConstant'

newdata

a vector of data to be (reverse) transformed

inverse

if TRUE, performs reverse transformation

Details

bestLogConstant estimates the optimal normalizing constant for a log transformation. This transformation can be performed on new data, and inverted, via the predict function.

Value

A list of class bestLogConstant with elements

x.t

transformed original data

x

original data

norm_stats

Pearson's Pearson's P / degrees of freedom

method

out-of-sample or in-sample, number of folds + repeats

chosen_constant

the chosen constant transformation (of class 'log_x')

other_transforms

the other transformations (of class 'log_x')

The predict function returns the numeric value of the transformation performed on new data, and allows for the inverse transformation as well.

See Also

bestNormalize, log_x,


petersonR/bestNormalize documentation built on March 15, 2024, 9:29 a.m.