jtrans: Johnson Transformation for Normality In wangyuchen/jtrans: Johnson Transformation for Normality

Description

`jtrans` transforms a continuous univariate vector to a random vector from standard normal distribution.

Usage

 ```1 2``` ```jtrans(x, test = "shapiro.test", exclude_original = TRUE, z_lim = c(0.25, 1.25), z_length = 101) ```

Arguments

 `x` the non-normal numerical data. `test` the normality test used to select fits, defaults to `shapiro.test` `exclude_original` whether the original data should be excluded when comparing fits. `z_lim` two values vector defining the range of the z values, defaults to 0.25 to 1.25, which is recommended by Mandraccia, Halverson and Chou (1996). `z_length` the length of the z vector, default to 101. The number of different fits estiamted in the algorithm. Set larger z.length value if you want extra precision.

Details

`jtrans` fits data to a set of distributions from Johnson family. A normality test is used to find the best fit by choosing the fit with maximum p.value under that given test. It returns the transformed data, the corresponding type of Johnson curve and parameter estimations.

Since the default Shapiro-Wilk test can only accept sample size between 3 and 5000, one should specify another normality test in the test parameter, generally the `ad.test` in the nortest package is recommended.

Sometimes, this algorithm may return poor fits. The most extreme case is that all the transformed data have smaller p.values than the original data's. In such cases, the `exclude_original` flag should be set to FALSE, so `jtrans` will return the original data as the transformed data.

Value

A list with two classes: the first one is the type of transformation used, the same as the `type` component, could be "sb", "su" or "sl"; The second one is "jtrans". The list containsthe following components:

 `original` original data. `transformed` transformed data. `type` type of transformation selected. `test` normality test used to select transformations. `z` selected z value among 101 values from 0.25 to 1.25. `eta, gamma, lambda, epsilon` transformation parameters. `p.value` the maximum p.value returned by test

References

Chou, Y. M., Polansky, A. M., & Mason, R. L. (1998). Transforming non-normal data to normality in statistical process control. Journal of Quality Technology, 30(2), 133-141.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```# generate 100 non-normal data and transform it. x <- rexp(50, .2) jt <- jtrans(x) jt plot(density(x)) plot(density(jt\$transformed)) qqnorm(jt\$transformed) qqline(jt\$transformed) ## Not run: # Using another normality test require(nortest) jtrans(x, test = "ad.test") ## End(Not run) ```

wangyuchen/jtrans documentation built on May 4, 2019, 12:58 a.m.