Statistical Methods
Apply a prespecified Box–Cox transformation reproducibly
Define the task
Use this transformation when the analysis plan calls for a particular power of strictly positive measurements. Record the measurement unit, power lambda and any prior offset. A change in units or an added constant changes the transformed values. Do not add an offset merely to make invalid measurements fit the formula; justify it scientifically and preserve the original column.
Carry out the check
For nonzero lambda, compute (x raised to lambda minus 1) divided by lambda. At lambda zero, use the natural logarithm. Apply exactly the same fitted or prespecified transformation to validation observations. If lambda was estimated, report the estimation procedure and training sample; the accompanying calculator applies a supplied lambda and does not estimate one or test normality.
Worked hypothetical example
For hypothetical values 1, 4 and 9 with lambda 0.5, the transformed values are 0, 2 and 4. At lambda zero the value 4 becomes log(4), about 1.386294. These values are transformed-scale measurements, not percentage changes. Inspect the model residuals and interpretation after transformation, and retain enough information to reverse the operation where needed. Never treat a visually more symmetric histogram as proof that every model assumption holds.
Method checked 15 November 2026 against SciPy documentation: scipy.special.boxcox.