Log and Box-Cox Transformations
Re-expressing a skewed or heteroskedastic variable on a different scale — most commonly the log scale, or the more flexible Box-Cox family — so that it better fits the assumptions behind linear regression.
Prerequisites: Ordinary Least Squares (OLS)
Many financial variables — market capitalization, trading volume, firm revenue — are strongly right-skewed: a handful of enormous values sit far out on the right, with everything else bunched near zero. Fitting a linear regression directly on such a variable often violates the assumption that residuals have constant variance, because the model fits the huge values poorly and the errors balloon exactly where the values are largest. The simplest fix is the log transformation: replacing with compresses large values much more than small ones, pulling in the right tail and often making the relationship with other variables closer to linear.
The Box-Cox transformation generalizes this idea with one parameter, , that is chosen (typically by maximum likelihood) rather than assumed: for , and exactly in the limit as . Trying leaves the data unchanged, gives a square-root-like compression, and recovers the ordinary log — so instead of guessing whether a log, square root, or no transform is right, Box-Cox searches over the whole family and picks the value of that makes the transformed data closest to satisfying the regression assumptions.
The log transform (and its generalization, the Box-Cox family, indexed by a parameter with the log as the special case) re-scales skewed financial variables so that regression's constant-variance and linearity assumptions hold better, at the cost of needing to convert results back off the transformed scale to interpret them.
Practice in interviews
Further reading
- Box and Cox, An Analysis of Transformations, JRSS-B (1964)