Log inStart free
LESSON 4.09 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW

Log and power transforms

Bend a skewed feature with a log, and watch its long tail fold in.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 4.09 · TRANSFORM BAY40 SHOPS · MEAN $11.5K · MEDIAN $5K · SKEW 2.52
01
Stage 1 of 6 · Skewed feature
Ad spend for 40 shops piles up near $0. A long right tail gives skewness 2.52.
Explain it simply

Each dot is one shop, placed by its weekly ad spend. 23 of the 40 shops spend under $8k, but 2 spend over $60k. Those 2 pull the mean, $11.5k, far right of the median, $5k. Skewness measures that lopsided tail. It is 2.52, and those 2 shops give 96 percent of it.

A dot histogram of 40 shops' ad spend, from $0 to $71.1k. Most dots sit below $8k. The two biggest spenders give 96% of the sum of cubes. The mean is $11.5k, the median $5k, the skewness 2.52.

shop: ad spend x, x′, sales ycurve, power λ, shift, best λskewness, −∞mean, fitted line, R²
the transform curve020406080ad spend x ($k)mean $11.5kmedian $5knumbers40 shops · 4 spend $0raw x: mean $11.5k · median $5kskewness g₁ = 2.522 shops: 96% of Σ z³the transform curve020406080ad spend x ($k)mean $11.5kmedian $5knumbers40 shops · 4 spend $0raw x: mean $11.5k · median $5kskewness g₁ = 2.522 shops: 96% of Σ z³
Toy: 40 shops · weekly ad spend x in $k (4 spend $0) · weekly sales y · seed 94
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
g1=1n∑i(xi−xˉσ)3\sy{g}{grad}{g_1} = \frac{1}{n}\sum_i \left(\frac{\sy{x}{data}{x_i} - \sy{mean}{out}{\bar x}}{\sigma}\right)^{3}
xˉ=11.45, σ=15.56; top shop: (71.1−11.4515.56)3=56.3; g1=2.52\bar x = 11.45,\ \sigma = 15.56;\ \text{top shop: } \left(\tfrac{71.1 - 11.45}{15.56}\right)^3 = 56.3;\ g_1 = 2.52

Skewness averages cubed distances from the mean, so a long tail dominates.

Common mix-ups

MYTHA stronger power always removes more skew.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With λ = 1, does the shape of the histogram change?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 2 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.