transNorm: Transform Variables to Normality

View source: R/effective_functions.r

transNormR Documentation

Transform Variables to Normality

Description

Note, that we do note use the Doornik-Hansen test because the implementation in 'normwh.test' has been archived. We continue to use the other methods prescribed in Velez et al.

Usage

transNorm(
  x,
  start = 0.01,
  family = c("bc", "yj"),
  lams,
  combine.method = c("Stouffer", "Fisher", "Average"),
  ...
)

Arguments

x

Vector of values to be transformed to normality

start

Positive value to be added to variable to ensure all values are positive. This follows the transformation of the variable to have its minimum value be zero.

family

Family of test - Box-Cox or Yeo-Johnson.

lams

A vector of length 2 giving the range of values for the transformation parameter.

combine.method

String giving the method used to to combine p-values from normality tests.

...

Other arguments, currently unimplemented.

Details

Uses the method proposed by Velez, Correa and Marmolejo-Ramos to normalize variables using Box-Cox or Yeo-Johnson transformations.

Value

A scalar giving the optimal transformation parameter.

References

Velez Jorge I., Correa Juan C., Marmolejo-Ramos Fernando. (2015) "A new approach to the Box-Cox Transformation" Frontiers in Applied Mathematics and Statistics.

Examples

data(wvs)
library(car)
lam <- transNorm(wvs$gdp_cap,
          family="yj",
          lams =c(-2,2))
wvs$trans_gdp <- yjPower(wvs$gdp_cap, 
             lambda=lam)

psre documentation built on Aug. 8, 2022, 5:05 p.m.

Related to transNorm in psre...