View source: R/transformTukey.r
transformTukey | R Documentation |
Conducts Tukey's Ladder of Powers on a vector of values to produce a more-normally distributed vector of values.
transformTukey(
x,
start = -10,
end = 10,
int = 0.025,
plotit = TRUE,
verbose = FALSE,
quiet = FALSE,
statistic = 1,
returnLambda = FALSE
)
x |
A vector of values. |
start |
The starting value of lambda to try. |
end |
The ending value of lambda to try. |
int |
The interval between lambda values to try. |
plotit |
If |
verbose |
If |
quiet |
If |
statistic |
If |
returnLambda |
If |
The function simply loops through lamdba values from start
to end
at an interval of int
.
The function then chooses the lambda which maximizes the Shapiro-Wilks W statistic or minimizes the Anderson-Darling A statistic.
It may be beneficial to add a constant to the input vector so that all values are posititive. For left-skewed data, a (Constant - X) transformation may be helpful. Large values may need to be scaled.
The transformed vector of values. The chosen lambda value is printed directly.
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
https://rcompanion.org/handbook/I_12.html
### Log-normal distribution example
Conc = rlnorm(100)
Conc.trans = transformTukey(Conc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.