Cannot use boxcox if data has zeroes. If data has zeros, then do this: Add 1 if most values are greater than 1, else if most of values <1, multiply 10 or 100, then add 1. Then do boxcox.

NormalCheckThenBoxCoxTransform(input.data, alpha.for.shapiro)

Arguments

input.data

A numerical data vector.

alpha.for.shapiro

Numerical value from 0 to 1. Threshold for what is considered not normal. If p-value is less than this threshold, then the data is considered not normal.

Value

A List with 4 elements:

  1. If data is non-normal, then a vector of the transformed data is outputted. If data is normal, then this is NULL.

  2. If data is non-normal, then a number specifying the lambda used for boxcox is outputted. If data is normal, then this is NULL.

  3. P-value from the Shapiro test.

  4. Boolean indicating if boxcox transformation was performed.

See also