Learn R Programming

psre (version 0.1.2)

transNorm: 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"),
  ...
)

Value

A scalar giving the optimal transformation parameter.

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.

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

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

Run the code above in your browser using DataLab