3
$\begingroup$

I am reading some resources about the Box-Cox transformation. Almost all of the websites I found give the formula of the transformation formula as

$$y^{(\lambda )} =\begin{cases}\frac{y^\lambda-1}{\lambda}&\lambda \neq 0\cr \ln y&\lambda =0\end{cases}.$$

However, they are often followed by a table gives very simple transformation as $$y^{(\lambda)}=y^{\lambda}$$ For example, $\lambda=2$ means the transformed data is $y^2$; $\lambda=-1$ means the transformed data is $\frac{1}{y}$, etc. See a link here: Box-Cox transformation I am just confused which formula should I use for the transformation.

$\endgroup$
3
  • 2
    $\begingroup$ If you're going to be fitting a linear model after a nonlinear transformation, linearly transforming that Box-Cox transformed value won't make any practical difference; it will just change the scale, which the coefficients then undo the effect of. So, generally speaking it doesn't really matter. The main value of the form where you subtract 1 and divide by $\lambda$ is it allows the power transforms include the $\ln$ transform at $\lambda=0$ rather than being degenerate, but once you have a specific $\lambda$ that's not zero, the linearly rescaling is usually not of practical consequence. $\endgroup$
    – Glen_b
    Jan 21 at 8:35
  • $\begingroup$ The first formulation is good for theory; the second formulation is what to use in practice. The nub is the twist needed to see in what sense the logarithms belong to the same family as the powers. $\endgroup$
    – Nick Cox
    Jan 21 at 12:19
  • $\begingroup$ Some understanding of how this arises will automatically answer your question. Consider, then, reading stats.stackexchange.com/questions/467494. $\endgroup$
    – whuber
    Jan 21 at 15:00

1 Answer 1

1
$\begingroup$

The difference between $y^{\lambda}$ and $\frac{y^{\lambda}-1}{\lambda}$ is a linear transformation, which in itself will not affect the relative shape of the distribution of $y$ - it will change absolute mean and variance however. The whole point is the non-linear part that will squeeze or stretch the distribution's tails.

In fact, the original paper describes both $\frac{y^{\lambda}-1}{\lambda}$ (1) and $y^{\lambda}$ (3):

Note that since an analysis of variance is unchanged by a linear transformation (1) is equivalent to (3); the form (1) is slightly preferable for theoretical analysis because it is continuous at $\lambda=0$.

It is more common in practice, if you are linearly transforming a variable, to replace that linear transformation by $\frac{y-\bar y}{\sqrt{\text{Var}(y)}}$, resulting in a standardized variable with mean 0 and variance 1. Determining optimal values of $\lambda$ such as by R's MASS::boxcox would use formula (1).

I should point out that while standardisation can definitely be a good idea (it stabilizes many numerical procedures, not in the least fitting of covariance matrices), Box-Cox tends to be applied rather mindlessly (all data must follow a normal distribution, right?).

As Stephan Kolassa raised in the comments, regressions on linearly transformed variables also are readily back-transformed (e.g. their predictions); this is not the case for non-linear transformations.

$\endgroup$
6
  • $\begingroup$ +1. Something that is often overlooked: if we want to back-transform predictions, then we need to be careful if we want unbiased expectation predictions, we can't just take the inverse transform, which many people do without thinking. $\endgroup$ Jan 21 at 10:16
  • 1
    $\begingroup$ In my reading it's not more common to use a standardized result, but it is hard to see consistent patterns. If Box-Cox were to return say 0.32 or 0.12 as the power, then some people use those powers literally and some people say, so let's use cube root or logarithm respectively. The latter is what Box and Cox did in their original paper and to my mind also on my small level it's the better idea. Points at issue include, as always, that all estimation is with error and there is some considerable virtue in models with simple interpretations. $\endgroup$
    – Nick Cox
    Jan 21 at 12:01
  • $\begingroup$ @NickCox I meant standardisation makes more sense 'when linearly transforming', I've updated my answer. My guess is most variables are not transformed at all, as this keeps interpretation more straightforward. $\endgroup$
    – PBulls
    Jan 21 at 12:08
  • $\begingroup$ If you're generalising across all statistical practice, then I guess it is true that transformations are the exception. I grew up in a field (the environmental side of geography) where logarithmic scale would be a more sensible default than the original scale for anything positive. As I've often underlined here, the examples in the Box and Cox paper are examples in which experienced data analysts would use logarithms and reciprocals any way. . $\endgroup$
    – Nick Cox
    Jan 21 at 12:15
  • 2
    $\begingroup$ The Box and Cox paper gave a big push to the idea that many transformations form a family (as was known previously) and to the idea that the data can hint at which transformation is best The idea that choice of transformation can be automated I think goes beyond what they ever said and is to me immensely less convincing. (I am not related to Sir David Cox.) $\endgroup$
    – Nick Cox
    Jan 21 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.