O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Box-Cox Transform

We will now illustrate the Box-Cox Power Transformation (also known as Power Transformation). This is a generic transform that will search for optimal transformations to use on your data. This transformation optimizes an exponent called lambda, which is then applied to your data. It does this by iterating over all exponents between -5 and +5 until it has found the best one to transform your data to a normal distribution:

boxcox(x~1)

As you can see from the plot produced from the boxcox() function (the third plot), the optimal exponent to apply the data will be somewhere between 0 and 1.

Next, we will apply the power function. The powerTransform() function will apply the optimal lambda just calculated to the original ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required